private void Button1_Click(object sender, EventArgs e) { if (selectedOrg == null) { MessageBox.Show("Выберите организацию"); } else { string hashPass = control.GetHash(textBoxCreateDocPassword.Text); Doctor dr = new Doctor { Auth = new DoctorAuth { Login = textBoxCreateDocLogin.Text, Password = hashPass }, Fio = textBoxCreateDocFio.Text, Speciality = textBoxCreateDocSpeciality.Text, Room = Convert.ToInt32(textBoxCreateDocRoom.Text), MedOrganizationId = selectedOrg.Id }; control.CreateDoctor(dr); FormAdministrator pform = (FormAdministrator)parentForm; pform.UpdateDataBindings(); Close(); } }
private void Button1_Click(object sender, EventArgs e) { Pacient pac = new Pacient { Auth = new PacientAuth { Login = textBoxCreatePacientLogin.Text, Password = control.GetHash(textBoxCreatePacientPassword.Text) }, Fio = textBoxCreatePacientFio.Text, Passport = textBoxCreatePacientPassport.Text, Oms = textBoxCreatePacientOms.Text, Phone = textBoxCreatePacientNumber.Text, Address = textBoxCreatePacientAddress.Text, Job = textBoxCreatePacientJob.Text, Position = textBoxCreatePacientPosition.Text }; if (action == "update") { if (targetId >= 0) { control.UpdatePacient(pac, targetId); } else { MessageBox.Show("Выберите изменяемую запись"); } } else { control.CreatePacient(pac); } FormAdministrator form = (FormAdministrator)parentForm; form.UpdateDataBindings(); Close(); }