public XtraFormDoctorDetail(Doctor doctor, bool isEditing)
        {
            InitializeComponent();

            this._doctor = doctor;

            textEditTcNumber.Text = _doctor.TcNo;
            textEditTcNumber.Properties.ReadOnly = !isEditing;
            textEditDoctorName.Text = _doctor.Name;
            textEditDoctorName.Properties.ReadOnly    = !isEditing;
            textEditDoctorSurname.Text                = _doctor.Surname;
            textEditDoctorSurname.Properties.ReadOnly = !isEditing;
            dateEditBirthDay.DateTime            = _doctor.BirthDay;
            dateEditBirthDay.Properties.ReadOnly = !isEditing;
            textEditMotherName.Text = _doctor.MotherName;
            textEditMotherName.Properties.ReadOnly = !isEditing;
            textEditFatherName.Text = _doctor.FatherName;
            textEditFatherName.Properties.ReadOnly   = !isEditing;
            lookUpEditDegree.EditValue               = _doctor.Degree.Id;
            lookUpEditDegree.Properties.ReadOnly     = !isEditing;
            lookUpEditDepartmant.EditValue           = _doctor.Department.Id;
            lookUpEditDepartmant.Properties.ReadOnly = !isEditing;
            checkEditIsActive.Checked             = _doctor.IsActive;
            checkEditIsActive.Properties.ReadOnly = !isEditing;
            doctorPhones = _doctor.DoctorPhones.ToList();
            doctorMails  = _doctor.DoctorMails.ToList();

            barButtonItemSaveNewDoctor.Caption = "Güncelle";
            barButtonItemSaveNewDoctor.Enabled = isEditing;

            update = true;
        }
        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 bindingSourceDoctor_CurrentChanged(object sender, EventArgs e)
        {
            Doctor doctor = bindingSourceDoctor.Current as Doctor;

            if (doctor == null)
            {
                return;
            }
            doctorPhonesBindingSource.DataSource = doctor.DoctorPhones;
            doctorMailsBindingSource.DataSource  = doctor.DoctorMails;
        }
        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 barButtonItemEditDoctor_ItemClick(object sender, ItemClickEventArgs e)
        {
            Doctor selectedDoctor = bindingSourceDoctor.Current as Doctor;

            if (selectedDoctor.IsNull())
            {
                Extensions.Extensions.ObjectNotSelectedForEdit();
                return;
            }
            XtraFormDoctorDetail formDoctorDetail = new XtraFormDoctorDetail(selectedDoctor, true);

            formDoctorDetail.Text = "Doktor Düzenle";
            formDoctorDetail.ShowDialog();
        }