private void BtCommint_Click(object sender, EventArgs e) { switch (tbNewPassword.Text != tbConfPass.Text) { case (true): tbConfPass.Clear(); tbNewPassword.Clear(); break; case (false): DataBaseProcedure procedure = new DataBaseProcedure(); DataBaseTables tables = new DataBaseTables(); tables.qrAccess_rights += " and [Access_rights_name] = " + "'Студент'"; tables.dtAccess_rightsFill(); Int32 Access_Rights_id = Convert.ToInt32(tables.dtAccess_rights. Rows[0][0].ToString()); procedure.spProfile_New_User(tbNewLogin.Text, tbConfPass.Text, Access_Rights_id, 1, tbImagePath.Text); procedure.spStudent_Insert(tbNewLogin.Text, ((StudentsForm)parentCreate).tbStudentSurname.Text, ((StudentsForm)parentCreate).tbStudentName.Text, ((StudentsForm)parentCreate).tbStudentMiddleName.Text, ((StudentsForm)parentCreate).mtbTicketNumber.Text, Convert.ToInt32(((StudentsForm)parentCreate). cbGroup.SelectedValue.ToString())); BtCancel_Click(sender, e); break; } }
private void btInsertUpdate_Click(object sender, EventArgs e) { switch (tbPassword.Text != tbConfPass.Text) { case (true): tbPassword.Clear(); tbConfPass.Clear(); Registry_Class.error_message += "\n" + DateTime.Now.ToLongDateString() + " пароли не совпадают!"; btError_Click(sender, e); break; case (false): switch (EmployeeCount) { case (0): switch (MessageBox.Show( "Создать ноую учётную запись:" + "\n Логин: " + cbLogin.Text + "," + "\n Права доступа: " + cbAccessRights.Text + "," + "\n Персональные данные:" + "\n Фамилия: " + tbSurName.Text + "," + "\n Имя:" + tbName.Text + "," + "\n Отчество: " + tbMiddleName.Text + ".", "Создание нового сотрудника", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { case DialogResult.Yes: DataBaseProcedure procedure = new DataBaseProcedure(); procedure.spProfile_New_User(cbLogin.Text, tbPassword.Text, Convert.ToInt32(cbAccessRights.SelectedValue.ToString()), 0, tbImagePath.Text); cbLogin.Text = ""; tbPassword.Clear(); tbConfPass.Clear(); tbSurName.Clear(); tbName.Clear(); tbMiddleName.Clear(); tbImagePath.Clear(); break; } break; default: switch (OldPassword == tbPassword.Text) { case (true): int access = 0; switch (OldRole == Convert.ToInt32(cbAccessRights.SelectedValue.ToString())) { case (true): access = 1; break; case (false): access = 0; break; } DataBaseProcedure procedure = new DataBaseProcedure(); procedure.spProfile_Update_User(cbLogin.Text, tbPassword.Text, Convert.ToInt32(cbAccessRights.SelectedValue.ToString()), access, tbImagePath.Text); procedure.spEmployee_Update(cbLogin.Text, tbSurName.Text, tbName.Text, tbMiddleName.Text); break; case (false): DynamicObjects dynamicObjects = new DynamicObjects(); dynamicObjects.parentCheck = this; dynamicObjects.createCheckPass(); break; } break; } break; } }