private void Save(object sender, RoutedEventArgs e)
        {
            patient.Title     = txtTitle.Text;
            patient.FirstName = txtFirstName.Text;
            patient.LastName  = txtLastName.Text;
            patient.PatientId = txtPatientId.Text;

            patient.Birthday = dtBirthday.DisplayDate;

            patient.Age     = Int32.Parse(txtAge.Text != "" ? txtAge.Text : "0");
            patient.AgeType = cbAgeType.SelectedIndex == 0 ? AgeType.Year : AgeType.Month;

            patient.StudyDate           = dtStudyDate.DisplayDate;
            patient.StudyDescription    = txtStudyDescription.Text;
            patient.RequestingPhysician = txtRequestingPhysician.Text;
            patient.AccessionNumber     = txtAccessionNumber.Text;
            patient.Note = txtNote.Text;

            //patient.Pregnant = cbPregnant.IsChecked == true ? true : false;
            patient.NA = cbNa.IsChecked == true ? true : false;

            patient.Gender = rdMale.IsChecked == true ? GenderType.Male : rdFemale.IsChecked == true ? GenderType.Female : GenderType.None;


            if (patient.FirstName.Trim() == "")
            {
                MessageControl messageControl = new MessageControl("Warning", "Please enter firstname!");
                messageControl.ShowDialog();
            }
            else if (patient.LastName.Trim() == "")
            {
                MessageControl messageControl = new MessageControl("Warning", "Please enter lastname!");
                messageControl.ShowDialog();
            }
            else if (patient.PatientId.Trim() == "")
            {
                MessageControl messageControl = new MessageControl("Warning", "Please enter patient ID!");
                messageControl.ShowDialog();
            }
            else
            {
                var item = patientDbContext.Patients.FirstOrDefault(i => i.Id == patient.Id);
                if (item == null || item.Id == -1)
                {
                    patient.Created = DateTime.Now;
                    patientDbContext.Patients.Add(patient);
                }
                else
                {
                    item = patient;
                }
                int value = patientDbContext.SaveChanges();

                if (value > -1)
                {
                    // MessageBox.Show("salam pesar!");
                    nowRefresh();
                }
            }
        }
 private void MoveToWorkbench(object sender, RoutedEventArgs e)
 {
     if (patient.Id != -1)
     {
         onSelectPatient(patient.Id, patient.FirstName + " " + patient.LastName);
     }
     else
     {
         MessageControl messageControl = new MessageControl("Warning", "Please choose a patient!");
         messageControl.ShowDialog();
         //MessageBox.Show("Please choose a patient!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }