private void btStudentInsert_Click(object sender, EventArgs e) { switch (cbStudentLogin.Text == "" || tbStudentName.Text == "" || tbStudentSurname.Text == "" || tbStudentMiddleName.Text == "" || mtbTicketNumber.Text == "") { case (true): MessageBox.Show("Одно или несколько из полей не заполнены!"); break; case (false): switch (btStudentInsert.Text) { case ("Добавить студента"): DataBaseView view = new DataBaseView(); view.qrvProfiles_List += " where [Login_list] = '" + cbStudentLogin.Text + "' and [Status_list] = 'Студент'"; view.dtvProfiles_List(); try { procedure.spStudent_Insert(view.vdtProfiles_List.Rows[0][0].ToString(), tbStudentSurname.Text, tbStudentName.Text, tbStudentMiddleName.Text, mtbTicketNumber.Text, Convert.ToInt32(cbGroup.SelectedValue.ToString())); cbStudentLogin.Items.Clear(); tbStudentMiddleName.Clear(); tbStudentName.Clear(); tbStudentSurname.Clear(); mtbTicketNumber.Clear(); } catch { switch (MessageBox.Show("Данного студента нет в системе учётных записей! \n Создать новую учётную запись?", "Создание учётной записи", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) { case DialogResult.Yes: DynamicObjects dynamic = new DynamicObjects(); dynamic.parentCreate = this; Thread thread1 = new Thread(dynamic.NewStudentAccountCreate); thread1.Start(); break; case DialogResult.No: break; } } break; case ("Поменять учебную группу"): DynamicObjects dynamicObjects = new DynamicObjects(); dynamicObjects.student = cbStudentLogin.Text; dynamicObjects.parent = this; Thread thread = new Thread(dynamicObjects.ChangeFormCreate); thread.Start(); break; } 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; } }