private void btn_OperatorChangeSave_Click(object sender, EventArgs e) { if (this.cb_OldSurname.SelectedIndex == -1) { this.cb_OldSurname.Focus(); return; } if (this.cb_OldNumber.SelectedIndex == -1) { this.cb_OldNumber.Focus(); return; } if ((this.tb_NewSurname.Text.Trim() == "") && (this.tb_NewNumber.Text.Trim() == "")) { this.tb_NewSurname.Focus(); return; } OperatorData myOD = new OperatorData(this.cb_OldSurname.Text, this.ConfigDocument); if (myOD.ReplaceOperatorData(this.tb_NewSurname.Text, this.tb_NewNumber.Text, this.cb_ExistingUserPrivileges.Text)) { MessageBox.Show(String.Concat("Operator ", this.cb_OldSurname.Text, " s osobnym cislom ", this.cb_OldNumber.Text, " bol nahradeny operatorom ", (this.tb_NewSurname.Text.Trim() == "") ? (this.cb_OldSurname.Text) : (this.tb_NewSurname.Text.Trim()), " s osobnym cislom ", (this.tb_NewNumber.Text.Trim() == "") ? (this.cb_OldNumber.Text) : (this.tb_NewNumber.Text.Trim()), ".")); this.ResetForm(); } }
private void OperatorLogin_Load(object sender, EventArgs e) { if (!this.ExtraLoginEnabled) { OperatorData myOD = new OperatorData(this.myXMLdoc); Array ar_OperatorsNumbers = myOD.GetActualNumbers(""); foreach (String actOperatorNumber in ar_OperatorsNumbers) { this.cb_OperatorLoginNr.Items.Add(actOperatorNumber); } Array ar_OperatorsSurnames = myOD.GetActualOperators(""); foreach (String actOperatorSurname in ar_OperatorsSurnames) { this.cb_OperatorSurname.Items.Add(actOperatorSurname); } } else { Login myLogin = new Login(); Array ar_OperatorsData = myLogin.GetOperatorsAllData(this.BelMESobj.Env.strTracePoint); foreach (NewLogin.OperatorData actOperatorData in ar_OperatorsData) { this.cb_OperatorLoginNr.Items.Add(actOperatorData.Number); this.cb_OperatorSurname.Items.Add(actOperatorData.Name); } } }
private void cb_OldNumber_SelectedIndexChanged(object sender, EventArgs e) { if (this.cb_OldNumber.SelectedIndex == -1) { return; } OperatorData myOD = new OperatorData(this.cb_OldNumber.Text, this.ConfigDocument, true); this.cb_OldSurname.Text = myOD.Surname; }
private void cb_OperatorNumber_SelectedIndexChanged(object sender, EventArgs e) { if (this.cb_OperatorNumber.SelectedIndex == -1) { this.cb_OperatorSurname.SelectedIndex = -1; this.cb_OperatorNumber.Focus(); return; } OperatorData myOD = new OperatorData(this.cb_OperatorNumber.Text, this.XMLConfigFile, true); this.cb_OperatorSurname.Text = myOD.Surname; }
private void cb_OperatorSurname_SelectedIndexChanged(object sender, EventArgs e) { if (!ExtraLoginEnabled) { OperatorData myOD = new OperatorData(this.cb_OperatorSurname.Text, this.myXMLdoc); this.cb_OperatorLoginNr.Text = myOD.Number; } else { Login myNL = new NewLogin.Login(); NewLogin.OperatorData myOD = myNL.GetOperatorData(this.cb_OperatorSurname.Text); this.cb_OperatorSurname.Text = myOD.Number; } this.tb_OperatorLoginPassword.Focus(); }
private void btn_DeleteUser_Click(object sender, EventArgs e) { if ((this.cb_OperatorNumber.SelectedIndex == -1) || (this.cb_OperatorSurname.SelectedIndex == -1)) { this.cb_OperatorSurname.Focus(); return; } OperatorData myOD = new OperatorData(this.cb_OperatorSurname.Text, this.XMLConfigFile); if (myOD.DeleteOperator()) { MessageBox.Show(String.Concat("Operator ", this.cb_OperatorSurname.Text, " s osobnym cislom ", this.cb_OperatorNumber.Text, " bol vymazany.")); this.cb_OperatorNumber.Items.Clear(); this.cb_OperatorSurname.Items.Clear(); this.DeleteOperatorForm_Load(new object(), new EventArgs()); } }
private void DeleteOperatorForm_Load(object sender, EventArgs e) { OperatorData myOD = new OperatorData(this.actUserName, this.XMLConfigFile); Array ar_OperatorNames = myOD.GetActualOperators(myOD.Privileges); Array.Sort(ar_OperatorNames); foreach (String actOperatorName in ar_OperatorNames) { this.cb_OperatorSurname.Items.Add(actOperatorName); } Array ar_OperatorNumbers = myOD.GetActualNumbers(myOD.Privileges); Array.Sort(ar_OperatorNumbers); foreach (String actOperatorNumber in ar_OperatorNumbers) { this.cb_OperatorNumber.Items.Add(actOperatorNumber); } }
private void btn_SAVE_Click(object sender, EventArgs e) { if (this.tb_OldPW.Text == "") { this.ErrorMessageBoxShow("Zadajte stare heslo."); this.tb_OldPW.Focus(); return; } OperatorData actOperator = new OperatorData(this.lbl_Operator.Text, this.UserConfig); if (this.tb_OldPW.Text != actOperator.Password) { this.ErrorMessageBoxShow("Stare heslo nie je spravne."); this.tb_OldPW.SelectAll(); this.tb_OldPW.Focus(); return; } if (this.tb_NewPW.Text.Length < 6) { this.ErrorMessageBoxShow("Nove heslo musi mat minimalne 6 znakov."); this.tb_NewPW.SelectAll(); this.tb_NewPW.Focus(); return; } if (this.tb_NewPW.Text != this.tb_NewPWVer.Text) { this.ErrorMessageBoxShow("Nove heslo nie je zhodne s jeho potvrdenim."); this.tb_NewPWVer.SelectAll(); this.tb_NewPWVer.Focus(); return; } actOperator.ChangePassword(this.tb_NewPW.Text); MessageBox.Show("Heslo bolo uspesne zmenene.", "Zmena hesla", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); }
private void UserMaintenanceForm_Load(object sender, EventArgs e) { OperatorData myOD = new OperatorData(this.actUserName, this.ConfigDocument); Array ar_OperatorsNames = myOD.GetActualOperators(myOD.Privileges); foreach (String actOperatorName in ar_OperatorsNames) { this.cb_OldSurname.Items.Add(actOperatorName); } Array ar_OperatorsNumbers = myOD.GetActualNumbers(myOD.Privileges); foreach (String actOperatorNumber in ar_OperatorsNumbers) { this.cb_OldNumber.Items.Add(actOperatorNumber); } this.cb_NewUserPrivileges.Items.Add("operator"); this.cb_ExistingUserPrivileges.Items.Add("operator"); if (myOD.Privileges == "admin") { this.cb_NewUserPrivileges.Items.Add("admin"); this.cb_NewUserPrivileges.Items.Add("useradmin"); this.cb_ExistingUserPrivileges.Items.Add("admin"); this.cb_ExistingUserPrivileges.Items.Add("useradmin"); } else if (myOD.Privileges == "useradmin") { this.cb_NewUserPrivileges.Items.Add("useradmin"); this.cb_ExistingUserPrivileges.Items.Add("useradmin"); } }
private void btn_NewOperator_Save_Click(object sender, EventArgs e) { if (this.tb_NewOP_name.Text == "") { this.ErrorMessageBoxShow("Zadajte meno operatora."); this.tb_NewOP_name.Focus(); return; } OperatorData myOD = new OperatorData(this.actUserName, this.ConfigDocument); if (Array.IndexOf(myOD.GetActualOperators(myOD.Privileges), this.tb_NewOP_name.Text) > -1) { this.ErrorMessageBoxShow(String.Concat("Operator s menom \"", this.tb_NewOP_name.Text, "\" uz existuje.")); this.tb_NewOP_name.Focus(); return; } if (this.tb_NewOP_number.Text == "") { this.ErrorMessageBoxShow("Zadajte osobne cislo operatora."); this.tb_NewOP_name.Focus(); return; } try { Int32 actNumber = Convert.ToInt32(this.tb_NewOP_number.Text); } catch { this.ErrorMessageBoxShow("Osobne cislo operatora nemôže obsahovat ine znaky ako cisla."); this.tb_NewOP_number.Focus(); return; } if (Array.IndexOf(myOD.GetActualNumbers(myOD.Privileges), this.tb_NewOP_number.Text) > -1) { this.ErrorMessageBoxShow(String.Concat("Operator s osobnym cislom \"", this.tb_NewOP_name.Text, "\" uz existuje.")); this.tb_NewOP_number.Focus(); return; } if (this.tb_NewOP_password.Text.Length < 6) { this.ErrorMessageBoxShow("Heslo musi mat minimalne 6 znakov."); this.tb_NewOP_password.Focus(); this.tb_NewOP_password.SelectAll(); return; } if (this.tb_NewOP_password.Text != this.tb_NewOP_PWVer.Text) { this.ErrorMessageBoxShow("Nove heslo nie je zhodne s jeho potvrdenim."); this.tb_NewOP_PWVer.Focus(); return; } if (this.cb_NewUserPrivileges.SelectedIndex == -1) { this.ErrorMessageBoxShow("Vyberte prava noveho uzivatela."); this.cb_NewUserPrivileges.Focus(); return; } OperatorData newOperator = new OperatorData(this.tb_NewOP_name.Text, this.tb_NewOP_number.Text, this.tb_NewOP_password.Text, this.cb_NewUserPrivileges.Text, this.ConfigDocument); if (newOperator.SaveNewOperator()) { MessageBox.Show(String.Concat("Operator s menom ", this.tb_NewOP_name.Text, " a cislom ", this.tb_NewOP_number.Text, " bol uspesne vytvoreny.")); this.ResetForm(); } }
private void btn_OperatorLoginOK_Click(object sender, EventArgs e) { if (!this.ExtraLoginEnabled) { OperatorData ope_data = new OperatorData(this.myXMLdoc); if (this.tb_OperatorScanField.Text.Trim().Length == 16) { String str_typedValidationString = this.tb_OperatorScanField.Text.Trim(); ope_data = new OperatorData(str_typedValidationString); if (ope_data.PasswordValidation(str_typedValidationString)) { this.PasswordValidation = true; this.LoggedOperatorNumber = ope_data.Number; this.LoggedOperatorSurname = ope_data.Surname; this.Privileges = ope_data.Privileges; if (!this.BelMESobj.EmployeeVerification(this.LoggedOperatorNumber)) { this.tb_OperatorScanField.Focus(); this.tb_OperatorScanField.SelectAll(); } else { this.Close(); } } return; } String str_OperatorNumberBelMes = this.cb_OperatorLoginNr.Text; /*while (str_OperatorNumberBelMes.Length > 5) * { * str_OperatorNumberBelMes = String.Concat("0", str_OperatorNumberBelMes); * }*/ if (ope_data.PasswordValidation(this.cb_OperatorLoginNr.Text, this.tb_OperatorLoginPassword.Text, this.myXMLdoc)) { this.PasswordValidation = true; if (this.BelMESenabled) { if (!this.BelMESobj.EmployeeVerification(str_OperatorNumberBelMes)) { this.tb_OperatorScanField.Focus(); this.tb_OperatorScanField.SelectAll(); this.PasswordValidation = false; MessageBox.Show(String.Concat("Neznamy operator. Zavolajte prosim nadriadeneho.\r", this.BelMESobj.Emp.strEmployeeNumber)); return; } } this.LoggedOperatorNumber = ope_data.Number; this.LoggedOperatorSurname = ope_data.Surname; this.Privileges = ope_data.Privileges; this.Close(); } else { this.tb_OperatorScanField.Text = @"Nespravne heslo"; this.tb_OperatorLoginPassword.Focus(); this.tb_OperatorLoginPassword.SelectAll(); return; } } else { NewLogin.Login myNL = new Login(this.BelMESobj.Env.strTracePoint); try { if (!this.BelMESobj.EmployeeVerification(this.cb_OperatorLoginNr.SelectedItem.ToString())) { MessageBox.Show(String.Concat(this.BelMESobj.Emp.strEmployeeCodeInfo)); } else { NewLogin.OperatorData ope_data = myNL.GetOperatorData(this.cb_OperatorSurname.SelectedItem.ToString()); this.LoggedOperatorNumber = ope_data.Number; this.LoggedOperatorSurname = ope_data.Name; ope_data.Privileges = ope_data.Privileges.Substring(0, ope_data.Privileges.Length - 1); this.Privileges = ope_data.Privileges; this.Close(); } } catch { } } }