private void labelOpenCommonMDI_DoubleClick(object sender, EventArgs e) { try { GlobalEnum.TaskID taskID = sender.Equals(this.pictureBoxLogo) ? GlobalEnum.TaskID.ListLogo : sender.Equals(this.pictureBoxFactory) ? GlobalEnum.TaskID.ListFactory : sender.Equals(this.pictureBoxOwner) ? GlobalEnum.TaskID.ListOwner : sender.Equals(this.pictureBoxCategory) ? GlobalEnum.TaskID.ListCategory : sender.Equals(this.pictureBoxProduct) ? GlobalEnum.TaskID.ListProduct : sender.Equals(this.pictureBoxCoil) ? GlobalEnum.TaskID.ListCoil : GlobalEnum.TaskID.ListCoil; CommonMDI commonMDI = new CommonMDI(taskID); if (commonMDI.ShowDialog() == System.Windows.Forms.DialogResult.OK || true) { CommonMetaList commonMetaList = new CommonMetaList(); switch (taskID) { case GlobalEnum.TaskID.ListLogo: this.comboBoxLogoID.DataSource = commonMetaList.GetListLogo(); break; case GlobalEnum.TaskID.ListFactory: this.comboBoxFactoryID.DataSource = commonMetaList.GetListFactory(); break; case GlobalEnum.TaskID.ListOwner: this.comboBoxOwnerID.DataSource = commonMetaList.GetListOwner(); break; case GlobalEnum.TaskID.ListCategory: this.comboBoxCategoryID.DataSource = commonMetaList.GetListCategory(); break; case GlobalEnum.TaskID.ListProduct: this.comboBoxProductID.DataSource = commonMetaList.GetListProduct(); break; case GlobalEnum.TaskID.ListCoil: this.comboBoxCoilID.DataSource = commonMetaList.GetListCoil(); break; default: break; } } commonMDI.Dispose(); } catch (Exception exception) { GlobalExceptionHandler.ShowExceptionMessageBox(this, exception); } }
private void buttonOK_Click(object sender, EventArgs e) { try { if (this.comboBoxEmployeeID.SelectedIndex < 0 || this.EmployeeID < 0) { throw new System.ArgumentException("Vui lòng chọn tên người sử dụng!"); } if (!this.commonMetaList.CheckPasswordSuccessful(this.EmployeeID, this.textBoxPassword.Text)) { throw new System.ArgumentException("Sai mật khẩu! Vui lòng kiểm tra lại trước khi tiếp tục."); } GlobalVariables.GlobalUserInformation = new UserInformation(this.EmployeeID, 1, this.comboBoxEmployeeID.Text); if (sender.Equals(this.buttonListEmployee)) { CommonMDI commonMDI = new CommonMDI(GlobalEnum.TaskID.ListEmployee); if (commonMDI.ShowDialog() == System.Windows.Forms.DialogResult.OK || true) { this.comboBoxEmployeeID.DataSource = this.commonMetaList.GetListEmployee(); } commonMDI.Dispose(); } if (sender.Equals(this.buttonOK)) { GlobalRegistry.Write("EmployeeID", "string" + this.EmployeeID); if (this.comboBoxImageS8PortName.SelectedIndex < 0 || this.comboBoxAutonicsPortName.SelectedIndex < 0) { throw new System.ArgumentException("Vui lòng chọn cổng COM!"); } if (this.comboBoxImageS8PortName.DataSource == null || this.comboBoxAutonicsPortName.DataSource == null) { GlobalVariables.ImageS8PortName = "COM 0"; GlobalVariables.AutonicsPortName = "COM 0"; } else { SQLDatabase.ExecuteNonQuery("UPDATE PublicPrinterProperties SET ImageS8PortName = N'" + (string)this.comboBoxImageS8PortName.SelectedValue + "', AutonicsPortName = N'" + (string)this.comboBoxAutonicsPortName.SelectedValue + "' "); GlobalVariables.ImageS8PortName = (string)this.comboBoxImageS8PortName.SelectedValue; GlobalVariables.AutonicsPortName = (string)this.comboBoxAutonicsPortName.SelectedValue; } } if (sender.Equals(this.labelChangePassword)) { PublicAuthenticationPassword publicAuthenticationPassword = new PublicAuthenticationPassword(); publicAuthenticationPassword.ShowDialog(); publicAuthenticationPassword.Dispose(); } } catch (Exception exception) { GlobalExceptionHandler.ShowExceptionMessageBox(this, exception); this.DialogResult = DialogResult.None; } }