| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using LB_SmartVision.SQL; |
| | | using LB_SmartVisionCommon; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Globalization; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using CsvHelper; |
| | | namespace LB_SmartVision.CSV |
| | | { |
| | | internal class CsvDataHelperRecordProductData |
| | | { |
| | | /// <summary> |
| | | /// å°RecordProductDatasåå
¸ä¿åå°CSVæä»¶ |
| | | /// </summary> |
| | | /// <param name="filePath">CSVæä»¶è·¯å¾</param> |
| | | /// <param name="recordProductDatas">è¦ä¿åçæ°æ®åå
¸</param> |
| | | public static void SaveToCsv(string filePath, List<RecordProductData> recordProductDatas) |
| | | { |
| | | try |
| | | { |
| | | using (var writer = new StreamWriter(filePath)) |
| | | using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture)) |
| | | { |
| | | csv.Context.RegisterClassMap<CsvRecordProductDataMap>(); |
| | | // å°åå
¸è½¬æ¢ä¸ºCsvRecordå表 |
| | | var records = recordProductDatas.Select(kvp => new CsvRecordProductData |
| | | { |
| | | //DictionaryKey = kvp.Key, |
| | | ProductName = kvp.ProductName, |
| | | ProductSN = kvp.ProductSN, |
| | | InspectionOperator = kvp.InspectionOperator, |
| | | NGType = kvp.NGType, |
| | | NGSize = kvp.NGSize, |
| | | DetectionTime = kvp.DetectionTime, |
| | | CameraInspection = kvp.CameraInspection, |
| | | |
| | | }).ToList(); |
| | | for (int i = 0; i < records.Count; i++) |
| | | { |
| | | AsyncLogHelper.Warn("ç©æå·æäº§ååç§°ï¼" + records[i].ProductName + "\r\n" + |
| | | "ï¼äº§åSNå·ï¼" + records[i].ProductSN + "\r\n" + |
| | | "ï¼æ£æµä½ä¸åï¼" + records[i].InspectionOperator + "\r\n" + |
| | | "ï¼NGç±»åï¼" + records[i].NGType + " mm" + "\r\n" + |
| | | "ï¼NG大å°ï¼" + records[i].NGSize + " mm" + "\r\n" + |
| | | "ï¼æ£æµæ¶é´ï¼" + records[i].DetectionTime + "\r\n" + |
| | | "ï¼æ£æµç¸æºï¼" + records[i].CameraInspection + " mm" + "\r\n" ); |
| | | |
| | | } |
| | | csv.WriteRecords(records); |
| | | } |
| | | LogHelper.Info($"æ°æ®æåä¿åå°: {filePath}"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Error($"ä¿åCSVæä»¶æ¶åºé: {ex.Message}"); |
| | | //throw; |
| | | } |
| | | //Task.Factory.StartNew(() => |
| | | //{ |
| | | //}); |
| | | } |
| | | /// <summary> |
| | | /// ä»CSVæä»¶è¯»åæ°æ®å°RecordProductDatasåå
¸ |
| | | /// </summary> |
| | | /// <param name="filePath">CSVæä»¶è·¯å¾</param> |
| | | /// <returns>读åçæ°æ®åå
¸</returns> |
| | | public static List<RecordProductData> LoadFromCsv(string filePath) |
| | | { |
| | | var recordProductDatas = new List<RecordProductData>(); |
| | | try |
| | | { |
| | | if (!File.Exists(filePath)) |
| | | { |
| | | LogHelper.Info($"æä»¶ä¸åå¨: {filePath}"); |
| | | return recordProductDatas; |
| | | } |
| | | using (var reader = new StreamReader(filePath)) |
| | | using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) |
| | | { |
| | | csv.Context.RegisterClassMap<CsvRecordProductDataMap>(); |
| | | var records = csv.GetRecords<CsvRecordProductData>(); |
| | | foreach (var record in records) |
| | | { |
| | | var productData = new RecordProductData |
| | | { |
| | | ProductName = record.ProductName, |
| | | ProductSN = record.ProductSN, |
| | | InspectionOperator = record.InspectionOperator, |
| | | NGType = record.NGType, |
| | | NGSize = record.NGSize, |
| | | DetectionTime = record.DetectionTime, |
| | | CameraInspection = record.CameraInspection, |
| | | }; |
| | | recordProductDatas.Add(productData); |
| | | } |
| | | } |
| | | LogHelper.Info($"ä» {filePath} æå读å {recordProductDatas.Count} æ¡è®°å½"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Error($"读åCSVæä»¶æ¶åºé: {ex.Message}"); |
| | | //throw; |
| | | } |
| | | return recordProductDatas; |
| | | } |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using CsvHelper.Configuration; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace LB_SmartVision.CSV |
| | | { |
| | | internal class CsvRecordProductDataMap:ClassMap<CsvRecordProductData> |
| | | { |
| | | public CsvRecordProductDataMap() |
| | | { |
| | | //Map(m => m.DictionaryKey).Name("è®°å½æ¶é´"); |
| | | Map(m => m.ProductName).Name("ç©æå·æäº§ååç§°"); |
| | | Map(m => m.ProductSN).Name("产åSNå·"); |
| | | Map(m => m.InspectionOperator).Name("æ£æµä½ä¸å"); |
| | | Map(m => m.NGType).Name("NGç±»å"); |
| | | Map(m => m.NGSize).Name("NG大å°"); |
| | | Map(m => m.DetectionTime).Name("æ£æµæ¶é´"); |
| | | Map(m => m.CameraInspection).Name("æ£æµç¸æº"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // |
| | | tableLayoutPanel4.Anchor = AnchorStyles.Top | AnchorStyles.Right; |
| | | tableLayoutPanel4.ColumnCount = 2; |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); |
| | | tableLayoutPanel4.Controls.Add(btnHisDataFind, 0, 0); |
| | | tableLayoutPanel4.Controls.Add(btnHisDataExport, 1, 0); |
| | | tableLayoutPanel4.Location = new Point(657, 509); |
| | | tableLayoutPanel4.Name = "tableLayoutPanel4"; |
| | | tableLayoutPanel4.RowCount = 1; |
| | | tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); |
| | | tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel4.Size = new Size(200, 39); |
| | | tableLayoutPanel4.TabIndex = 1; |
| | | // |
| | |
| | | btnHisDataFind.Text = "æ¥è¯¢"; |
| | | btnHisDataFind.TextColor = Color.White; |
| | | btnHisDataFind.WarningColor = Color.FromArgb(230, 162, 60); |
| | | btnHisDataFind.Click += btnHisDataFind_Click; |
| | | // |
| | | // btnHisDataExport |
| | | // |
| | |
| | | Name = "HistoricalDataEditPage"; |
| | | Size = new Size(866, 580); |
| | | grpHisData.ResumeLayout(false); |
| | | grpHisData.PerformLayout(); |
| | | tableLayoutPanel1.ResumeLayout(false); |
| | | tableLayoutPanel2.ResumeLayout(false); |
| | | tableLayoutPanel3.ResumeLayout(false); |
| | |
| | | using LB_SmartVisionCommon; |
| | | using LB_SmartVision.CSV; |
| | | using LB_SmartVision.SQL; |
| | | using LB_SmartVisionCommon; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Globalization; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | |
| | | public partial class HistoricalDataEditPage : UserControl |
| | | { |
| | | public Action<string, LogInfoType> LogInfo; |
| | | // ä¿ååå§æ°æ®çå表 |
| | | private List<DataGridViewRow> originalRows = new List<DataGridViewRow>(); |
| | | |
| | | private int row2OriginalHeight; |
| | | private int row3OriginalHeight; |
| | | |
| | | List<RecordProductData> RecordProductDatas = new List<RecordProductData>(); |
| | | public HistoricalDataEditPage() |
| | | { |
| | | Name = "HistoricalDataEditPage"; |
| | |
| | | /// </summary> |
| | | private void InitializeDataGridView() |
| | | { |
| | | // 设置DataGridViewå宽 |
| | | dataGridViewHD.ColumnCount = 4; |
| | | |
| | | int totalWidth = dataGridViewHD.ClientSize.Width; |
| | | int columnCount = dataGridViewHD.ColumnCount; |
| | | int columnWidth = totalWidth / columnCount; |
| | | |
| | | // 设置æå°å®½åº¦ |
| | | int minWidth = 100; // æå°å®½åº¦ |
| | | if (columnWidth < minWidth) |
| | | { |
| | | columnWidth = minWidth; |
| | | } |
| | | |
| | | for (int i = 0; i < columnCount; i++) |
| | | { |
| | | dataGridViewHD.Columns[i].Width = columnWidth; |
| | | } |
| | | |
| | | // è®¾ç½®åæ é¢ |
| | | dataGridViewHD.Columns[0].Name = "SNå·"; |
| | | dataGridViewHD.Columns[1].Name = "æ¶é´"; |
| | | dataGridViewHD.Columns[2].Name = "NGç±»"; |
| | | dataGridViewHD.Columns[3].Name = "缺é·å¤§å°"; |
| | | this.dataGridViewHD.DataSource = RecordProductDatas; |
| | | |
| | | dataGridViewHD.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; |
| | | |
| | |
| | | { |
| | | dateTimePickerEnd.MinDate = dateTimePickerStart.Value; |
| | | } |
| | | |
| | | private void btnHisDataExport_Click(object sender, EventArgs e) |
| | | public string OpenFileForSave() |
| | | { |
| | | |
| | | } |
| | | |
| | | public void SaveToCSV(string filePath, int rowIndex) |
| | | { |
| | | // ä½¿ç¨ StreamWriter æ¥åå
¥æä»¶ |
| | | using (StreamWriter writer = new StreamWriter(filePath)) |
| | | using (SaveFileDialog saveFileDialog = new SaveFileDialog()) |
| | | { |
| | | DataGridViewRow row = dataGridViewHD.Rows[rowIndex]; |
| | | // 设置é»è®¤æä»¶ååæ©å±å |
| | | saveFileDialog.FileName = $"å岿°æ®_{DateTime.Now:yyyyMMdd_HHmmss}"; |
| | | saveFileDialog.DefaultExt = "xlsx"; |
| | | |
| | | int rowCount = 10;//10æ¹ä¸ºé鿬¡æ° |
| | | // 设置æä»¶è¿æ»¤å¨ |
| | | saveFileDialog.Filter = "Excelæä»¶ (*.xlsx)|*.xlsx|" + |
| | | "CSVæä»¶ (*.csv)|*.csv|" + |
| | | "ææ¬æä»¶ (*.txt)|*.txt|" + |
| | | "æææä»¶ (*.*)|*.*"; |
| | | |
| | | writer.WriteLine("SNå·, æ¶é´, NGç±», 缺é·å¤§å°"); |
| | | saveFileDialog.Title = "éæ©æä»¶ä¿åä½ç½®"; |
| | | saveFileDialog.RestoreDirectory = true; // è®°ä½ä¸æ¬¡æå¼çç®å½ |
| | | saveFileDialog.OverwritePrompt = true; // è¦çæ¶æç¤º |
| | | |
| | | // é忝ä¸è¡æ°æ® |
| | | for (int i = 0; i < rowCount; i++) |
| | | if (saveFileDialog.ShowDialog() == DialogResult.OK) |
| | | { |
| | | int batchSize = 4; |
| | | |
| | | // åå
¥è¿ä¸æ¹æ¬¡çæ¯ä¸åæ°æ® |
| | | for (int k = 0; k < batchSize; k++) |
| | | { |
| | | writer.Write($"{row.Cells[k].Value}"); |
| | | |
| | | // å¨å
ç´ ä¹é´æ·»å éå·ï¼é¤éè¿æ¯æåä¸ä¸ªå
ç´ |
| | | if (k < batchSize - 1) |
| | | { |
| | | writer.Write(","); |
| | | } |
| | | } |
| | | |
| | | // åå
¥å®ä¸è¡åï¼æ¢è¡ |
| | | writer.WriteLine(); |
| | | |
| | | string filePathHD = saveFileDialog.FileName; |
| | | return filePathHD; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | private void btnHisDataExport_Click(object sender, EventArgs e) |
| | | { |
| | | CsvDataHelperRecordProductData.SaveToCsv(OpenFileForSave(), RecordProductDatas); |
| | | } |
| | | |
| | | private void btnHisDataFind_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | DateTime startDate = dateTimePickerStart.Value.Date; |
| | | DateTime endDate = dateTimePickerEnd.Value.Date; |
| | | |
| | | switch(comboBoxSearchBasis.SelectedIndex) |
| | | { |
| | | //便®æ¥ææ¥è¯¢ |
| | | case 0: |
| | | RecordProductDatas = RecordProductDataRepository.GetRecordsByTimeRange(DateTime.Parse(this.dateTimePickerStart.Value.ToString()), DateTime.Parse(this.dateTimePickerEnd.Value.ToString())); |
| | | break; |
| | | //便®SNå·æ¥è¯¢ |
| | | case 1: |
| | | if(string.IsNullOrEmpty(textBoxSN.Text)) |
| | | { |
| | | MessageBox.Show("请填åSNå·ï¼", "æç¤º", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| | | } |
| | | else |
| | | { |
| | | RecordProductDatas = RecordProductDataRepository.GetRecordsByProductNumber(textBoxSN.Text); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | this.dataGridViewHD.DataSource = RecordProductDatas; |
| | | this.dataGridViewHD.AutoGenerateColumns = true; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | comboBoxPermission = new ComboBox(); |
| | | dataGridViewUM = new DataGridView(); |
| | | tableLayoutPanel4 = new TableLayoutPanel(); |
| | | btnEdit = new HopeButton(); |
| | | btnFind = new HopeButton(); |
| | | btnDel = new HopeButton(); |
| | | btnEdit = new HopeButton(); |
| | | btnAdd = new ForeverButton(); |
| | | btnDel = new HopeButton(); |
| | | grpSetting.SuspendLayout(); |
| | | tableLayoutPanel1.SuspendLayout(); |
| | | tableLayoutPanel2.SuspendLayout(); |
| | |
| | | // |
| | | tableLayoutPanel4.Anchor = AnchorStyles.Top | AnchorStyles.Right; |
| | | tableLayoutPanel4.ColumnCount = 4; |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); |
| | | tableLayoutPanel4.Controls.Add(btnEdit, 1, 0); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F)); |
| | | tableLayoutPanel4.Controls.Add(btnFind, 0, 0); |
| | | tableLayoutPanel4.Controls.Add(btnDel, 3, 0); |
| | | tableLayoutPanel4.Controls.Add(btnEdit, 1, 0); |
| | | tableLayoutPanel4.Controls.Add(btnAdd, 2, 0); |
| | | tableLayoutPanel4.Controls.Add(btnDel, 3, 0); |
| | | tableLayoutPanel4.Location = new Point(457, 509); |
| | | tableLayoutPanel4.Name = "tableLayoutPanel4"; |
| | | tableLayoutPanel4.RowCount = 1; |
| | | tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel4.Size = new Size(400, 39); |
| | | tableLayoutPanel4.TabIndex = 1; |
| | | // |
| | | // btnFind |
| | | // |
| | | btnFind.BorderColor = Color.FromArgb(220, 223, 230); |
| | | btnFind.ButtonType = ReaLTaiizor.Util.HopeButtonType.Primary; |
| | | btnFind.DangerColor = Color.FromArgb(245, 108, 108); |
| | | btnFind.DefaultColor = Color.FromArgb(255, 255, 255); |
| | | btnFind.Font = new Font("Segoe UI", 12F); |
| | | btnFind.HoverTextColor = Color.FromArgb(48, 49, 51); |
| | | btnFind.InfoColor = Color.FromArgb(144, 147, 153); |
| | | btnFind.Location = new Point(3, 3); |
| | | btnFind.Name = "btnFind"; |
| | | btnFind.PrimaryColor = Color.FromArgb(64, 158, 255); |
| | | btnFind.Size = new Size(94, 33); |
| | | btnFind.SuccessColor = Color.FromArgb(103, 194, 58); |
| | | btnFind.TabIndex = 1; |
| | | btnFind.Text = "æ¥è¯¢"; |
| | | btnFind.TextColor = Color.White; |
| | | btnFind.WarningColor = Color.FromArgb(230, 162, 60); |
| | | btnFind.Click += btnFind_Click; |
| | | // |
| | | // btnEdit |
| | | // |
| | |
| | | btnEdit.WarningColor = Color.FromArgb(230, 162, 60); |
| | | btnEdit.Click += btnEdit_Click; |
| | | // |
| | | // btnFind |
| | | // btnAdd |
| | | // |
| | | btnFind.BorderColor = Color.FromArgb(220, 223, 230); |
| | | btnFind.ButtonType = ReaLTaiizor.Util.HopeButtonType.Primary; |
| | | btnFind.DangerColor = Color.FromArgb(245, 108, 108); |
| | | btnFind.DefaultColor = Color.FromArgb(255, 255, 255); |
| | | btnFind.Font = new Font("Segoe UI", 12F); |
| | | btnFind.HoverTextColor = Color.FromArgb(48, 49, 51); |
| | | btnFind.InfoColor = Color.FromArgb(144, 147, 153); |
| | | btnFind.Location = new Point(3, 3); |
| | | btnFind.Name = "btnFind"; |
| | | btnFind.PrimaryColor = Color.FromArgb(64, 158, 255); |
| | | btnFind.Size = new Size(94, 33); |
| | | btnFind.SuccessColor = Color.FromArgb(103, 194, 58); |
| | | btnFind.TabIndex = 1; |
| | | btnFind.Text = "æ¥è¯¢"; |
| | | btnFind.TextColor = Color.White; |
| | | btnFind.WarningColor = Color.FromArgb(230, 162, 60); |
| | | btnAdd.BackColor = Color.Transparent; |
| | | btnAdd.BaseColor = Color.FromArgb(35, 168, 109); |
| | | btnAdd.Font = new Font("Segoe UI", 12F); |
| | | btnAdd.Location = new Point(203, 3); |
| | | btnAdd.Name = "btnAdd"; |
| | | btnAdd.Rounded = false; |
| | | btnAdd.Size = new Size(94, 33); |
| | | btnAdd.TabIndex = 4; |
| | | btnAdd.Text = "æ·»å "; |
| | | btnAdd.TextColor = Color.FromArgb(243, 243, 243); |
| | | btnAdd.Click += btnAdd_Click; |
| | | // |
| | | // btnDel |
| | | // |
| | |
| | | btnDel.TextColor = Color.White; |
| | | btnDel.WarningColor = Color.FromArgb(230, 162, 60); |
| | | btnDel.Click += btnDel_Click; |
| | | // |
| | | // btnAdd |
| | | // |
| | | btnAdd.BackColor = Color.Transparent; |
| | | btnAdd.BaseColor = Color.FromArgb(35, 168, 109); |
| | | btnAdd.Font = new Font("Segoe UI", 12F); |
| | | btnAdd.Location = new Point(203, 3); |
| | | btnAdd.Name = "btnAdd"; |
| | | btnAdd.Rounded = false; |
| | | btnAdd.Size = new Size(94, 33); |
| | | btnAdd.TabIndex = 4; |
| | | btnAdd.Text = "æ·»å "; |
| | | btnAdd.TextColor = Color.FromArgb(243, 243, 243); |
| | | btnAdd.Click += btnAdd_Click; |
| | | // |
| | | // UserManagementEditPage |
| | | // |
| | |
| | | using LB_SmartVision.Forms.Pages.ProcessPage; |
| | | using LB_SmartVision.Forms.Pages.CameraPage; |
| | | using LB_SmartVision.Forms.Pages.ProcessPage; |
| | | using LB_SmartVision.Forms.Pages.SettingPage; |
| | | using LB_SmartVision.ProcessRun; |
| | | using LB_SmartVision.SQL; |
| | | using LB_SmartVisionCommon; |
| | | using LB_VisionControl; |
| | | using LB_VisionProcesses; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Serialization; |
| | | using System.Collections.Concurrent; |
| | | using System.Data; |
| | | using System.Text; |
| | | using VisionControl.Forms; |
| | | using LB_SmartVision.Forms.Pages.SettingPage; |
| | | using LB_SmartVisionCommon; |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; |
| | | using LB_SmartVision.Forms.Pages.CameraPage; |
| | | using System.Security.Principal; |
| | | using System.Text; |
| | | using System.Windows.Forms; |
| | | using VisionControl.Forms; |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; |
| | | |
| | | namespace LB_SmartVision.Forms.Pages.UserManagementPage |
| | | { |
| | | public partial class UserManagementEditPage : UserControl |
| | | { |
| | | public Action<string, LogInfoType> LogInfo; |
| | | List<RecordUserData> recordUserDatas = new List<RecordUserData>(); |
| | | |
| | | public UserManagementEditPage() |
| | | { |
| | |
| | | Text = "ç¨æ·ç®¡ç设置"; |
| | | |
| | | InitializeComponent(); |
| | | InitializeDataGridView(); |
| | | InitializeComboBox(); |
| | | InitializeDataGridView(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private void InitializeDataGridView() |
| | | { |
| | | this.dataGridViewUM.DataSource = recordUserDatas; |
| | | // 设置DataGridViewå宽 |
| | | dataGridViewUM.ColumnCount = 4; |
| | | |
| | | int totalWidth = dataGridViewUM.ClientSize.Width; |
| | | int columnCount = dataGridViewUM.ColumnCount; |
| | | int columnWidth = totalWidth / columnCount; |
| | | |
| | | // 设置æå°å®½åº¦ |
| | | int minWidth = 100; // æå°å®½åº¦ |
| | | if (columnWidth < minWidth) |
| | | { |
| | | columnWidth = minWidth; |
| | | } |
| | | |
| | | for (int i = 0; i < columnCount; i++) |
| | | { |
| | | dataGridViewUM.Columns[i].Width = columnWidth; |
| | | } |
| | | |
| | | // è®¾ç½®åæ é¢ |
| | | dataGridViewUM.Columns[0].Name = "ç¨æ·å"; |
| | | //dataGridViewUM.Columns[1].Name = "å¯ç "; |
| | | dataGridViewUM.Columns[1].Name = "å§å"; |
| | | dataGridViewUM.Columns[2].Name = "å·¥å·"; |
| | | dataGridViewUM.Columns[3].Name = "æé"; |
| | | |
| | | dataGridViewUM.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; |
| | | |
| | | // ç¦æ¢ç¼è¾åå
æ ¼ï¼å¯éï¼ |
| | | dataGridViewUM.ReadOnly = true; |
| | | |
| | | // å
许å¤è¡éæ©ï¼å¯éï¼ |
| | | dataGridViewUM.MultiSelect = false; |
| | | |
| | | // æ¾ç¤ºè¡æ é¢ï¼å¯éï¼ |
| | | dataGridViewUM.RowHeadersVisible = true; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | comboBoxPermission.SelectedIndex = 0; |
| | | textBoxUsername.Focus(); // å°ç¦ç¹è®¾ç½®åç¨æ·åè¾å
¥æ¡ |
| | | } |
| | | |
| | | #region æ·»å ç¨æ·æé® |
| | | private void btnAdd_Click(object sender, EventArgs e) |
| | | { |
| | | // éªè¯è¾å
¥ |
| | |
| | | return; |
| | | } |
| | | |
| | | // å建æ°è¡æ°æ® |
| | | string[] row = new string[] |
| | | RecordUserData user = new RecordUserData(); |
| | | user.EmployeeNumber = this.textBoxEmployeeID.Text; |
| | | user.EmployeeAccount = this.textBoxUsername.Text; |
| | | user.EmployeePassword = this.textBoxPassword.Text; |
| | | user.EmployeeName = this.textBoxName.Text; |
| | | user.EmployeePermission = (UserPermission)this.comboBoxPermission.SelectedIndex; |
| | | // æ·»å å° UserManager |
| | | bool success = UserManager.Instance.AddUser(user); |
| | | |
| | | if (success) |
| | | { |
| | | textBoxUsername.Text, |
| | | //textBoxPassword.Text, // å®é
åºç¨ä¸å¯ç åºè¯¥å å¯ |
| | | textBoxName.Text, |
| | | textBoxEmployeeID.Text, |
| | | comboBoxPermission.SelectedItem.ToString() |
| | | }; |
| | | recordUserDatas.Add(user); |
| | | |
| | | // 设置æ´ä¸ªDataGridViewçé»è®¤åä½åé¢è² |
| | | dataGridViewUM.DefaultCellStyle.Font = new Font("å®ä½", 12); |
| | | dataGridViewUM.DefaultCellStyle.ForeColor = Color.Black; // åä½é¢è² |
| | | dataGridViewUM.DefaultCellStyle.BackColor = Color.White; // èæ¯é¢è² |
| | | //MessageBox.Show("ç¨æ·æ·»å æåï¼", "æç¤º", |
| | | // MessageBoxButtons.OK, MessageBoxIcon.Information); |
| | | |
| | | // æ·»å æ°è¡å°DataGridView |
| | | dataGridViewUM.Rows.Add(row); |
| | | // æ¸
空è¾å
¥æ¡ |
| | | ClearInputFields(); |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("æ·»å ç¨æ·å¤±è´¥ï¼", "é误", |
| | | MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | } |
| | | |
| | | // æ¸
空è¾å
¥æ¡ |
| | | ClearInputFields(); |
| | | } |
| | | #endregion |
| | | |
| | | #region å é¤ç¨æ·æé® |
| | | private void btnDel_Click(object sender, EventArgs e) |
| | | { |
| | | if (dataGridViewUM.SelectedRows.Count > 0) |
| | | { |
| | | // è·åéä¸çè¡ |
| | | DataGridViewRow selectedRow = dataGridViewUM.SelectedRows[0]; |
| | | |
| | | // 确认å é¤ |
| | | DialogResult result = MessageBox.Show("ç¡®å®è¦å é¤éä¸çè¡åï¼", |
| | | "确认å é¤", MessageBoxButtons.YesNo, MessageBoxIcon.Question); |
| | | |
| | | if (result == DialogResult.Yes) |
| | | { |
| | | foreach (DataGridViewRow row in dataGridViewUM.SelectedRows) |
| | | try |
| | | { |
| | | dataGridViewUM.Rows.Remove(row); |
| | | // å
è·åè¦å é¤çæ°æ® |
| | | string employeeNumber = selectedRow.Cells[0].Value?.ToString(); |
| | | |
| | | if (!string.IsNullOrEmpty(employeeNumber)) |
| | | { |
| | | // 1. 仿°æ®æºå é¤ |
| | | var dataSource = dataGridViewUM.DataSource as List<RecordUserData>; |
| | | if (dataSource != null) |
| | | { |
| | | var itemToRemove = dataSource.FirstOrDefault(u => u.EmployeeNumber == employeeNumber); |
| | | if (itemToRemove != null) |
| | | { |
| | | dataSource.Remove(itemToRemove); |
| | | } |
| | | } |
| | | |
| | | // 2. ä»ç¨æ·ç®¡çå¨å é¤ |
| | | UserManager.Instance.DeleteUser(employeeNumber); |
| | | |
| | | // 3. å·æ°æ°æ®ç»å® |
| | | dataGridViewUM.DataSource = null; |
| | | dataGridViewUM.DataSource = dataSource; |
| | | |
| | | //MessageBox.Show("å 餿åï¼", "æç¤º", |
| | | // MessageBoxButtons.OK, MessageBoxIcon.Information); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"å é¤å¤±è´¥: {ex.Message}", "é误", |
| | | MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | } |
| | | } |
| | | } |
| | |
| | | MessageBoxButtons.OK, MessageBoxIcon.Information); |
| | | } |
| | | } |
| | | #endregion |
| | | private int editingRowIndex = -1; |
| | | private bool isEditingMode = false; |
| | | private string originalButtonText = "ä¿®æ¹"; |
| | | #region ä¿®æ¹ç¨æ·ä¿¡æ¯ |
| | | private void btnEdit_Click(object sender, EventArgs e) |
| | | { |
| | | // åå
æ ¼å¯ç¼è¾ |
| | |
| | | // æ¸
空è¾å
¥æ¡ |
| | | ClearInputFields(); |
| | | |
| | | MessageBox.Show("ä¿®æ¹å®æï¼", "æç¤º", |
| | | MessageBoxButtons.OK, MessageBoxIcon.Information); |
| | | RecordUserData user = new RecordUserData(); |
| | | user.EmployeeNumber = this.textBoxEmployeeID.Text; |
| | | user.EmployeeAccount = this.textBoxUsername.Text; |
| | | user.EmployeePassword = this.textBoxPassword.Text; |
| | | user.EmployeeName = this.textBoxName.Text; |
| | | user.EmployeePermission = (UserPermission)this.comboBoxPermission.SelectedIndex; |
| | | UserManager.Instance.UpdateUser(user); |
| | | |
| | | //MessageBox.Show("ä¿®æ¹å®æï¼", "æç¤º", |
| | | // MessageBoxButtons.OK, MessageBoxIcon.Information); |
| | | } |
| | | } |
| | | |
| | |
| | | //textBoxPassword.PlaceholderText = "å¦éä¿®æ¹å¯ç 请填å"; |
| | | } |
| | | } |
| | | |
| | | private void UpdateRowData(int rowIndex) |
| | | { |
| | | if (rowIndex >= 0 && rowIndex < dataGridViewUM.Rows.Count) |
| | |
| | | row.Cells[3].Value = comboBoxPermission.SelectedItem.ToString(); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region æ¥è¯¢ç¨æ·ä¿¡æ¯ |
| | | private void btnFind_Click(object sender, EventArgs e) |
| | | { |
| | | List<RecordUserData> recordUserDatas = UserManager.Instance.GetAllUsers(); |
| | | this.dataGridViewUM.DataSource = recordUserDatas; |
| | | this.dataGridViewUM.AutoGenerateColumns = true; |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="CsvHelper" Version="33.1.0" /> |
| | | <PackageReference Include="MaterialSkin.NET5" Version="1.0.2" /> |
| | | </ItemGroup> |
| | | |
| | |
| | | InspectionOperator VARCHAR(255), |
| | | NGType VARCHAR(255), |
| | | NGSize VARCHAR(255), |
| | | DetectionTime VARCHAR(255)), |
| | | DetectionTime VARCHAR(255), |
| | | CameraInspection VARCHAR(255), |
| | | CreatedDate DATETIME DEFAULT CURRENT_TIMESTAMP, |
| | | INDEX idx_created_date (CreatedDate), |
| | |
| | | theme_VisionForm.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 0); |
| | | theme_VisionForm.Image = (Image)resources.GetObject("theme_VisionForm.Image"); |
| | | theme_VisionForm.Location = new Point(0, 0); |
| | | theme_VisionForm.Margin = new Padding(4); |
| | | theme_VisionForm.Name = "theme_VisionForm"; |
| | | theme_VisionForm.Padding = new Padding(10, 70, 10, 9); |
| | | theme_VisionForm.Padding = new Padding(12, 88, 12, 11); |
| | | theme_VisionForm.RoundCorners = true; |
| | | theme_VisionForm.Sizable = true; |
| | | theme_VisionForm.Size = new Size(1152, 704); |
| | | theme_VisionForm.Size = new Size(1440, 880); |
| | | theme_VisionForm.SmartBounds = true; |
| | | theme_VisionForm.StartPosition = FormStartPosition.WindowsDefaultLocation; |
| | | theme_VisionForm.TabIndex = 0; |
| | |
| | | // |
| | | sc_VisionForm.Dock = DockStyle.Fill; |
| | | sc_VisionForm.FixedPanel = FixedPanel.Panel2; |
| | | sc_VisionForm.Location = new Point(10, 70); |
| | | sc_VisionForm.Location = new Point(12, 88); |
| | | sc_VisionForm.Margin = new Padding(4); |
| | | sc_VisionForm.Name = "sc_VisionForm"; |
| | | sc_VisionForm.Orientation = Orientation.Horizontal; |
| | | // |
| | |
| | | // sc_VisionForm.Panel2 |
| | | // |
| | | sc_VisionForm.Panel2.Controls.Add(grb_Info); |
| | | sc_VisionForm.Size = new Size(1132, 625); |
| | | sc_VisionForm.SplitterDistance = 476; |
| | | sc_VisionForm.Size = new Size(1416, 781); |
| | | sc_VisionForm.SplitterDistance = 593; |
| | | sc_VisionForm.SplitterWidth = 5; |
| | | sc_VisionForm.TabIndex = 1; |
| | | // |
| | | // tlp_MainView |
| | |
| | | tlp_MainView.Margin = new Padding(2); |
| | | tlp_MainView.Name = "tlp_MainView"; |
| | | tlp_MainView.RowCount = 3; |
| | | tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Absolute, 48F)); |
| | | tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Absolute, 31F)); |
| | | tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F)); |
| | | tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Absolute, 39F)); |
| | | tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | | tlp_MainView.Size = new Size(1132, 476); |
| | | tlp_MainView.Size = new Size(1416, 593); |
| | | tlp_MainView.TabIndex = 1; |
| | | tlp_MainView.TagString = null; |
| | | // |
| | |
| | | materialTabControl.AccessibleRole = AccessibleRole.Sound; |
| | | materialTabControl.Depth = 0; |
| | | materialTabControl.Dock = DockStyle.Fill; |
| | | materialTabControl.Location = new Point(2, 81); |
| | | materialTabControl.Location = new Point(2, 101); |
| | | materialTabControl.Margin = new Padding(2); |
| | | materialTabControl.MouseState = MaterialSkin.MouseState.HOVER; |
| | | materialTabControl.Name = "materialTabControl"; |
| | | materialTabControl.SelectedIndex = 0; |
| | | materialTabControl.Size = new Size(1128, 393); |
| | | materialTabControl.Size = new Size(1412, 490); |
| | | materialTabControl.TabIndex = 0; |
| | | // |
| | | // tlp_VisionMainOperator |
| | |
| | | tlp_VisionMainOperator.Controls.Add(btn_GlobalVar, 7, 0); |
| | | tlp_VisionMainOperator.Controls.Add(com_ProductName, 8, 0); |
| | | tlp_VisionMainOperator.Dock = DockStyle.Fill; |
| | | tlp_VisionMainOperator.Location = new Point(3, 51); |
| | | tlp_VisionMainOperator.Location = new Point(4, 64); |
| | | tlp_VisionMainOperator.Margin = new Padding(4); |
| | | tlp_VisionMainOperator.Name = "tlp_VisionMainOperator"; |
| | | tlp_VisionMainOperator.RowCount = 1; |
| | | tlp_VisionMainOperator.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | | tlp_VisionMainOperator.Size = new Size(1126, 25); |
| | | tlp_VisionMainOperator.Size = new Size(1408, 31); |
| | | tlp_VisionMainOperator.TabIndex = 0; |
| | | tlp_VisionMainOperator.TagString = null; |
| | | // |
| | |
| | | ckb_AllowRun.Dock = DockStyle.Fill; |
| | | ckb_AllowRun.Font = new Font("å®ä½", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134); |
| | | ckb_AllowRun.ForeColor = SystemColors.Control; |
| | | ckb_AllowRun.Location = new Point(3, 3); |
| | | ckb_AllowRun.Location = new Point(4, 4); |
| | | ckb_AllowRun.Margin = new Padding(4); |
| | | ckb_AllowRun.MinimumSize = new Size(1, 1); |
| | | ckb_AllowRun.Name = "ckb_AllowRun"; |
| | | ckb_AllowRun.Size = new Size(119, 19); |
| | | ckb_AllowRun.Size = new Size(148, 23); |
| | | ckb_AllowRun.TabIndex = 2; |
| | | ckb_AllowRun.Text = "è¿è¡æ¨¡å¼"; |
| | | // |
| | |
| | | btn_Login.Image = null; |
| | | btn_Login.ImageAlign = ContentAlignment.MiddleLeft; |
| | | btn_Login.InactiveColor = Color.FromArgb(32, 34, 37); |
| | | btn_Login.Location = new Point(128, 3); |
| | | btn_Login.Location = new Point(160, 4); |
| | | btn_Login.Margin = new Padding(4); |
| | | btn_Login.Name = "btn_Login"; |
| | | btn_Login.PressedBorderColor = Color.FromArgb(165, 37, 37); |
| | | btn_Login.PressedColor = Color.FromArgb(165, 37, 37); |
| | | btn_Login.Size = new Size(119, 19); |
| | | btn_Login.Size = new Size(148, 23); |
| | | btn_Login.TabIndex = 3; |
| | | btn_Login.Text = "ç¨æ·ç»å½"; |
| | | btn_Login.TextAlignment = StringAlignment.Center; |
| | |
| | | btn_GlobalVar.Image = null; |
| | | btn_GlobalVar.ImageAlign = ContentAlignment.MiddleLeft; |
| | | btn_GlobalVar.InactiveColor = Color.FromArgb(32, 34, 37); |
| | | btn_GlobalVar.Location = new Point(878, 3); |
| | | btn_GlobalVar.Location = new Point(1096, 4); |
| | | btn_GlobalVar.Margin = new Padding(4); |
| | | btn_GlobalVar.Name = "btn_GlobalVar"; |
| | | btn_GlobalVar.PressedBorderColor = Color.FromArgb(165, 37, 37); |
| | | btn_GlobalVar.PressedColor = Color.FromArgb(165, 37, 37); |
| | | btn_GlobalVar.Size = new Size(119, 19); |
| | | btn_GlobalVar.Size = new Size(148, 23); |
| | | btn_GlobalVar.TabIndex = 4; |
| | | btn_GlobalVar.Text = "å
¨å±åé"; |
| | | btn_GlobalVar.TextAlignment = StringAlignment.Center; |
| | |
| | | com_ProductName.Font = new Font("å®ä½", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134); |
| | | com_ProductName.FormattingEnabled = true; |
| | | com_ProductName.ItemHeight = 20; |
| | | com_ProductName.Location = new Point(1003, 3); |
| | | com_ProductName.Location = new Point(1252, 4); |
| | | com_ProductName.Margin = new Padding(4); |
| | | com_ProductName.Name = "com_ProductName"; |
| | | com_ProductName.Size = new Size(120, 26); |
| | | com_ProductName.Size = new Size(152, 26); |
| | | com_ProductName.TabIndex = 5; |
| | | com_ProductName.SelectedValueChanged += com_ProductName_SelectedValueChanged; |
| | | // |
| | |
| | | materialTabSelector.BaseTabControl = null; |
| | | materialTabSelector.Depth = 0; |
| | | materialTabSelector.Dock = DockStyle.Fill; |
| | | materialTabSelector.Location = new Point(3, 3); |
| | | materialTabSelector.Location = new Point(4, 4); |
| | | materialTabSelector.Margin = new Padding(4); |
| | | materialTabSelector.MouseState = MaterialSkin.MouseState.HOVER; |
| | | materialTabSelector.Name = "materialTabSelector"; |
| | | materialTabSelector.Size = new Size(1126, 42); |
| | | materialTabSelector.Size = new Size(1408, 52); |
| | | materialTabSelector.TabIndex = 1; |
| | | // |
| | | // grb_Info |
| | |
| | | grb_Info.Font = new Font("å®ä½", 12F, FontStyle.Regular, GraphicsUnit.Point, 134); |
| | | grb_Info.ForeColor = SystemColors.Control; |
| | | grb_Info.Location = new Point(0, 0); |
| | | grb_Info.Margin = new Padding(4, 5, 4, 5); |
| | | grb_Info.Margin = new Padding(5, 6, 5, 6); |
| | | grb_Info.MinimumSize = new Size(1, 1); |
| | | grb_Info.Name = "grb_Info"; |
| | | grb_Info.Padding = new Padding(0, 32, 0, 0); |
| | | grb_Info.Size = new Size(1132, 145); |
| | | grb_Info.Padding = new Padding(0, 40, 0, 0); |
| | | grb_Info.Size = new Size(1416, 183); |
| | | grb_Info.TabIndex = 1; |
| | | grb_Info.Text = "æ¥å¿æ¾ç¤ºåºï¼"; |
| | | grb_Info.TextAlignment = ContentAlignment.MiddleLeft; |
| | |
| | | rich_Info.Dock = DockStyle.Fill; |
| | | rich_Info.FillColor = Color.FromArgb(32, 41, 50); |
| | | rich_Info.Font = new Font("å®ä½", 12F, FontStyle.Regular, GraphicsUnit.Point, 134); |
| | | rich_Info.Location = new Point(0, 32); |
| | | rich_Info.Location = new Point(0, 40); |
| | | rich_Info.Margin = new Padding(4, 5, 4, 5); |
| | | rich_Info.MinimumSize = new Size(1, 1); |
| | | rich_Info.Name = "rich_Info"; |
| | | rich_Info.Padding = new Padding(2); |
| | | rich_Info.ShowText = false; |
| | | rich_Info.Size = new Size(1132, 113); |
| | | rich_Info.Size = new Size(1416, 143); |
| | | rich_Info.TabIndex = 0; |
| | | rich_Info.TextAlignment = ContentAlignment.MiddleLeft; |
| | | // |
| | |
| | | cb_VisionForm.EnableMaximizeButton = true; |
| | | cb_VisionForm.EnableMinimizeButton = true; |
| | | cb_VisionForm.ForeColor = Color.FromArgb(155, 155, 155); |
| | | cb_VisionForm.Location = new Point(1072, 14); |
| | | cb_VisionForm.Location = new Point(1330, 18); |
| | | cb_VisionForm.Margin = new Padding(4); |
| | | cb_VisionForm.MaximizeHoverColor = Color.FromArgb(74, 74, 74); |
| | | cb_VisionForm.MinimizeHoverColor = Color.FromArgb(63, 63, 65); |
| | | cb_VisionForm.Name = "cb_VisionForm"; |
| | |
| | | // |
| | | // VisionForm |
| | | // |
| | | AutoScaleDimensions = new SizeF(96F, 96F); |
| | | AutoScaleDimensions = new SizeF(120F, 120F); |
| | | AutoScaleMode = AutoScaleMode.Dpi; |
| | | ClientSize = new Size(1152, 704); |
| | | ClientSize = new Size(1440, 880); |
| | | Controls.Add(theme_VisionForm); |
| | | FormBorderStyle = FormBorderStyle.None; |
| | | Icon = (Icon)resources.GetObject("$this.Icon"); |
| | | MinimumSize = new Size(261, 61); |
| | | Margin = new Padding(4); |
| | | MinimumSize = new Size(326, 76); |
| | | Name = "VisionForm"; |
| | | Text = "è½®èå¤è§è§è§æ£æµç³»ç»"; |
| | | TransparencyKey = Color.Fuchsia; |
| | |
| | | using LB_SmartVision.Forms.Pages.SettingPage; |
| | | using LB_SmartVision.Forms.Pages.UserManagementPage; |
| | | using LB_SmartVision.ProcessRun; |
| | | using LB_SmartVision.SQL; |
| | | using LB_SmartVision.Tool; |
| | | using LB_SmartVisionCommon; |
| | | using LB_SmartVisionLoginUI; |
| | |
| | | com_ProductName.Items.Add("æ°å¢"); |
| | | com_ProductName.Text = GlobalVar.strProductName; |
| | | this.WindowState = FormWindowState.Maximized; |
| | | DatabaseRecordProductDataHelper.InitializeDatabase(); |
| | | } |
| | | |
| | | public void SaveAllSetting() |
| | |
| | | <data name="theme_VisionForm.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | | <value> |
| | | iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO |
| | | vAAADrwBlbxySQAAA+JJREFUWEftVkuIHGUQbt34iMEoq2S2q3p3yTJsuqpnJ+L6WBRdwaigohfFgEou |
| | | BkVBUPCBCEG8BXNQ48GLeImCehIJxMsqhsSZruod46K4HtSIGjU+4iOr0c1I9fSsM3/PLNtCPO0H36m/ |
| | | evz/X11VnreKVRTAHPOZumkY6lFwqURws3BwZ8ywTQnuiCP/+iTCzY1qaUPzdm/Atf3PaHre6XPsjyQM |
| | | 2xLGV4XwIyX4QRj+UMK/lPFvJTyhBMeV8IgQvmRJuH4Ko+l5p9UjGBbCJ5RxTgj+VMZmXxKcSAjekHE/ |
| | | NNs5DgaTKLinEQYVO4Trf1mkV81wixLUslPmA3bzF2XcKeP+hWY/u3n0fCXcrQwLyjAvjNsb1dI6N05P |
| | | mFAIHlHG73sEypPgGwnhfpn0zzH7jzddcK4Q7kqfKNMI4a9K+MwBDgbdeF04MBWsFYYdQvhbLlBvfhKT |
| | | f+vMtLfG7C0JJXxKGY67WnvCmPAFGRs7z42boul5AzHBfdK6TjdQtzPGk8oos5F/5Y7sfVvPhg+lp+1h |
| | | 0yIsxARPmtaN78WEl8eEX+SNclxUhne0glUrNrN9zfMGlPAuZTzaQ99FYfwuDv3ruoLvq5bWaQSvZCfL |
| | | GXUYLwrj240Qxtu2lkSN4FpdWfKZH9jb9RQ1Cq62f9sVOlxUxn3KQXnJ0PO8QxU/jBm1h74v7ZniEG9K |
| | | Hdg/quzvXO709k0Y3u08ucGqWgheX862H4XgxbR47SqU8D1X0EXC2VmGizqDz0xPr0kYH9eO360gNe0b |
| | | jWppozB+1kOQEb5MCLa0C64NoeGrhOGrvH6lhK81GiIvnggmrDLzgvTkvwvDA+5wsU4nhG/m9AUoBD/F |
| | | HFzWN4H0XQn2vF8eXN8Z3FAPYasl59oUYjuB+sTImDB+nhfgYQ39STf4fmu1DHtz+oIUgiM1KkWtwcFw |
| | | sOujVT3hrnaL7UQc+hcL5W+sKIXhw0OVjaW0iwnBc47gqIQ45QY32PKRzv8eTguRYM9SS5YouEEZjv37 |
| | | EffbzbjBDdZyxZYQ12EB2qS0bWrJqRVazPDWkojwZbuZrsgZtDJ0iY1g12khEtTicMTvclwn2CKE32YJ |
| | | 7G5PORfZ1HtMCH7MOV4BrQ3XCe92+4onk5Nn2PolDAvWXnuOzAwzo6Nnx4Q3SrojwqfKeMxWMpsXWVs+ |
| | | 2WrfKRdbW1W6Hf0shM/33Y7my4PrleFZIfhAaWjU/e5ivlw+y3S2FySMtynjvcrwsFiLJv/RhPBB2ws1 |
| | | hK2WcBLBFf1qawlplwvxaQlxe786OOU4PBWsjSO85mBlQ8n99r/BisSdAas4FfgHpdEUZpwUX7sAAAAA |
| | | SUVORK5CYII= |
| | | vAAADrwBlbxySQAAA+xJREFUWEftV0loFUkYbvcNFzJi0lWdBEPQruqXKEYdcRgz4AYqeplBwYiXEUVB |
| | | UHAhCEG8iR509OBlmIsOjJ5EBvQSRVHzuvslxjAy8eCG+75GozF+f716L6873fqe2ykffDR59e9/1V8V |
| | | ow99KARtUg72J5aypGNN8xy2yJPWcleylb5gS13HnJdy+KSW6uJx3b8ZA7TKl6PbMPq3SbMsBUcpyf/2 |
| | | BP8PDh96kr32BX/rS/4O30789grfO1j/k4LQ6p8POO6XdFgpDNbDSZsn2Bt8u2MpWGdKsCPeBNMm3TZp |
| | | FaUc6/cW20pQEtpsflCllmwxjDbpLKOd9vAZuBPOx5J+86TyMdDbBxsdYLsn+SpUZYQy/imQILLdBIP3 |
| | | cxzEU7Dbns3WejXmcNK/NPGHkajabtUiLYO/nyOgXWdRFeUkDmdnWMOg2ACFFwEn8fzfFeaSxlpjIOlT |
| | | EHC0HVm/CstSC13B93sVFaOVszDQpwGuYGtQLipnQDlMyLzH12t2zJ8adH/TbeMbVLYROmmyDvjYRrLK |
| | | aS4Q3Y/gtWjFALtg6KSf4NW02Uj3HwSPzOuw9iAk24sI/p5rm3OV0wyOo+++ww7pzCIViVjvAk+02GyC |
| | | VlWnpUmw2Qggn+AV0eZ/A61oEtYsOttRwjlE5vy4L61KrabQmjBtV3I/JPtRUptcmy9UBuiM+tLc+bHs |
| | | aQ1Rn8rNnEC7Gpvr8KcqF0XoHVCbl0qB8p2OEspS8OZmySZrvwqNtbUDMRm3Yj9kj1uB9NXcwLkfjwyu |
| | | RAhoshuYcHMyGy4DT5T+jKrcjNbJh+yW75QIw62yqhDAvUghwV/Cybrw5UKTDn08GqmTJ9GCx660pscG |
| | | oPoq2MHzlUWjtN8skjZbRsGFdQpiJoBkVVkFnF3tLcCv+7ZZo31mcYZGLY5RL/kCiQrcaRLFTvrikOxc |
| | | YJF2PeZ5ZsTmAkNkCtaiW1YAkcTF1sT4YjXFEM3ekMADz+YztM8AULqlqE5nSL5wor3Zkew51nxU4WnP |
| | | Ij9DlVGLIWCtDhV6FzBWIJH9a3pNaZOGQRsNT6tjWSHB/6LK6OUA/ETJVER/O9dgwcQ7w7XLTG0yjSTO |
| | | Onp7Ny3A92VuuTD0rbcFbXsUMJonaQwnBV8Rniu4y2sGYbEe5emA8cORV6ZGY3n5UNycC9AKvBHZZRh+ |
| | | iqxoX9BlRWMZozvLLiSEV5V6HT2Bjz9iX0ftaAWE9sDoBV+UlOufY9FeWTmE5OhdgLH8Kxyvhv5GON3q |
| | | C3NzSvD19C70MTco4JTDZsbtrSzUlLP5DnBV3D745riOp5nr8F/OJcYV65++P2iTfNV/MPoQCcP4AKXR |
| | | FGYxo/VGAAAAAElFTkSuQmCC |
| | | </value> |
| | | </data> |
| | | <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | |
| | | { |
| | | _currentUser = user; |
| | | } |
| | | if (!CheckPermission(true)) |
| | | { |
| | | MessageBox.Show("éè¦ç®¡çåæéæè½æ·»å ç¨æ·ï¼", "æéä¸è¶³", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| | | return false; |
| | | } |
| | | //if (!CheckPermission(true)) |
| | | //{ |
| | | // MessageBox.Show("éè¦ç®¡çåæéæè½æ·»å ç¨æ·ï¼", "æéä¸è¶³", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| | | // return false; |
| | | //} |
| | | |
| | | if (_users.Any(u => u.Value.EmployeeNumber == user.EmployeeNumber || |
| | | u.Value.EmployeeAccount == user.EmployeeAccount)) |
| | |
| | | MessageBox.Show("åå·¥å·æè´¦å·å·²åå¨ï¼", "æ·»å 失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| | | return false; |
| | | } |
| | | |
| | | RecordUserData recordUserData = new RecordUserData(); |
| | | recordUserData.EmployeeNumber = user.EmployeeNumber; |
| | | recordUserData.EmployeeAccount = user.EmployeeAccount; |
| | |
| | | /// <returns>æ¯å¦å 餿å</returns> |
| | | public bool DeleteUser(string employeeNumber) |
| | | { |
| | | if (!CheckPermission(true)) |
| | | { |
| | | MessageBox.Show("éè¦ç®¡çåæéæè½å é¤ç¨æ·ï¼", "æéä¸è¶³", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| | | return false; |
| | | } |
| | | //if (!CheckPermission(true)) |
| | | //{ |
| | | // MessageBox.Show("éè¦ç®¡çåæéæè½å é¤ç¨æ·ï¼", "æéä¸è¶³", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| | | // return false; |
| | | //} |
| | | |
| | | // 管çåä¸è½å é¤èªå·± |
| | | if (_currentUser.EmployeeNumber == employeeNumber) |
| | | { |
| | | MessageBox.Show("ä¸è½å é¤å½åç»å½çç¨æ·ï¼", "å é¤å¤±è´¥", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| | | return false; |
| | | } |
| | | //// 管çåä¸è½å é¤èªå·± |
| | | //if (_currentUser.EmployeeNumber == employeeNumber) |
| | | //{ |
| | | // MessageBox.Show("ä¸è½å é¤å½åç»å½çç¨æ·ï¼", "å é¤å¤±è´¥", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| | | // return false; |
| | | //} |
| | | |
| | | var user = _users.FirstOrDefault(u => u.Value.EmployeeNumber == employeeNumber); |
| | | if (user.Value != null) |