private void barButtonItemDeleteDoctor_ItemClick(object sender, ItemClickEventArgs e) { Doctor doctor = bindingSourceDoctor.Current as Doctor; if (doctor.IsNull()) { Extensions.Extensions.ObjectNotSelectedForDelete(); return; } if (Extensions.Extensions.DeletingAlert(doctor.Name + " " + doctor.Surname) != DialogResult.Yes) { return; } Extensions.Extensions.ShowWaitForm(description: "Doktor siliniyor..."); DoctorSolClient client = Extensions.Extensions.GetDoctorSolClient(); ProcessResult processResult = client.Delete(doctor.Id); SplashScreenManager.CloseForm(false); Extensions.Extensions.ProcessResultMessage(processResult.Errors, (int)processResult.Result); if (processResult.Result == ExtensionsBLLResult.Success) { RefreshData(); } }
private void barButtonItemSaveNewDoctor_ItemClick(object sender, ItemClickEventArgs e) { Extensions.Extensions.ShowWaitForm(description: "Doktor kaydediliyor..."); DoctorSolClient clientDoctor = Extensions.Extensions.GetDoctorSolClient(); if (clientDoctor == null) { return; } if (_doctor == null) { _doctor = new Doctor { TcNo = textEditTcNumber.Text, Name = textEditDoctorName.Text, Surname = textEditDoctorSurname.Text, BirthDay = dateEditBirthDay.DateTime, RegistrationNumber = textEditTcNumber.Text, DegreeId = Convert.ToInt32(lookUpEditDegree.EditValue ?? 0), DepartmentId = Convert.ToInt32(lookUpEditDepartmant.EditValue ?? 0), MotherName = textEditMotherName.Text, FatherName = textEditFatherName.Text, IsActive = checkEditIsActive.Checked, DoctorMails = doctorMails.ToArray(), DoctorPhones = doctorPhones.ToArray() }; } else { _doctor.TcNo = textEditTcNumber.Text; _doctor.Name = textEditDoctorName.Text; _doctor.Surname = textEditDoctorSurname.Text; _doctor.BirthDay = dateEditBirthDay.DateTime; _doctor.RegistrationNumber = textEditTcNumber.Text; _doctor.DegreeId = Convert.ToInt32(lookUpEditDegree.EditValue ?? 0); _doctor.DepartmentId = Convert.ToInt32(lookUpEditDepartmant.EditValue ?? 0); _doctor.MotherName = textEditMotherName.Text; _doctor.FatherName = textEditFatherName.Text; _doctor.IsActive = checkEditIsActive.Checked; _doctor.DoctorPhones = doctorPhones.ToArray(); _doctor.DoctorMails = doctorMails.ToArray(); } ProcessResult processResultDoctor = update ? clientDoctor.Update(_doctor) : clientDoctor.Insert(_doctor); SplashScreenManager.CloseForm(false); Extensions.Extensions.ProcessResultMessage(processResultDoctor.Errors, (int)processResultDoctor.Result); Close(); }
private void RefreshData() { DoctorSolClient doctorSolClient = Extensions.Extensions.GetDoctorSolClient(); bindingSourceDoctor.DataSource = doctorSolClient.Doctors(true); doctorSolClient.Close(); DoctorMailSolClient doctorMailSolClient = Extensions.Extensions.GetDoctorMailClient(); bindingSourceMail.DataSource = doctorMailSolClient.DoctorMails(true); doctorMailSolClient.Close(); DoctorPhoneSolClient doctorPhoneSolClient = Extensions.Extensions.GetDoctorPhoneSolClient(); bindingSourcePhone.DataSource = doctorPhoneSolClient.DoctorPhones(true); doctorPhoneSolClient.Close(); }
public static DoctorSolClient GetDoctorSolClient() { DoctorSolClient client; try { client = new DoctorSolClient(binding, new EndpointAddress(String.Format(GlobalVariables.ServiceRoot + "/{0}", "DoctorService.svc"))); client.Select(-1); } catch (Exception) { bool b = Program.TestService(); if (!b) { Application.Exit(); } client = new DoctorSolClient(binding, new EndpointAddress(String.Format(GlobalVariables.ServiceRoot + "/{0}", "DoctorService.svc"))); } return(client); }