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 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 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(); } }