private void Add_New_Person_OnLoaded(object sender, RoutedEventArgs e)
        {


            Fill_Generic_Data fill = new Fill_Generic_Data();
            ComboBoxLogic comboboxLogic = new ComboBoxLogic();
            List<ph_tutors> tutor = new List<ph_tutors>();
            TXTLogic txtLogic = new TXTLogic();
            
            if (EditData == null)
            {
              _generic = new GenericPersonViewModel();
                cmbUniversity.ItemsSource = comboboxLogic.Unis();
            }
            else
            {
                _generic = fill.All(EditData.id);
                tutor = txtLogic.Tutor(EditData.id);
               // topic = txtLogic.Topic(editData.id);
            }
            cmbSpecialty.ItemsSource = comboboxLogic.SpecialtyList();
            cmbUniversity.ItemsSource = comboboxLogic.Unis();
            cmbCurrentMunicipality.ItemsSource = comboboxLogic.Regions();
            cmbMunicipality.ItemsSource = comboboxLogic.Regions();
            cmbGender.ItemsSource = comboboxLogic.Gender();
            cmbCountry.ItemsSource = comboboxLogic.ReadCountry();
            cmbEgnType.ItemsSource = comboboxLogic.Id_Types();
            cmbAccReason.ItemsSource = comboboxLogic.AccReason();
            cmbFormEdu.ItemsSource = comboboxLogic.FormEdu();
            cmbTypeEdu.ItemsSource = comboboxLogic.Type();
            cmbStatus.ItemsSource = comboboxLogic.Status();
            cmbLastLevel.ItemsSource = comboboxLogic.Levels();
            cmbLastEdu.ItemsSource = comboboxLogic.ReadCountry();
            
            cmbUniversity.DataContext = EditData;
            dtgrdTutor.DataContext = tutor;
           // txtTopic.DataContext = topic;
            this.DataContext = _generic;

            //identitycards.un_persons = personView;
        }
 private void CmbFaculty_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     cmbDepartment.ItemsSource = null;
     ComboBoxLogic comboboxLogic = new ComboBoxLogic();
     ComboBoxModel sel = (ComboBoxModel)cmbFaculty.SelectedItem;
     cmbDepartment.IsEnabled = true;
     if (sel != null)
     {
         cmbDepartment.ItemsSource = comboboxLogic.Department(sel.id);
     }
 }
 private void cmbUniversity_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     cmbDepartment.IsEnabled = false;
     ComboBoxLogic comboboxLogic = new ComboBoxLogic();
     ComboBoxModel sel = (ComboBoxModel)cmbUniversity.SelectedItem;
     cmbFaculty.IsEnabled = true;
     if (sel != null) cmbFaculty.ItemsSource = comboboxLogic.Faculties(sel.id);
     cmbFaculty.DataContext = EditData;
     cmbDepartment.ItemsSource = null;
     cmbDepartment.IsEnabled = false;
 }
 private void CmbCurrentMunicipality_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     ComboBoxModel sel = new ComboBoxModel();
     ComboBoxLogic comboboxLogic = new ComboBoxLogic();
     sel = (ComboBoxModel)cmbCurrentMunicipality.SelectedItem;
     if (sel != null)
     {
         cmbCurrentCity.IsEnabled = true;
         cmbCity.ItemsSource = comboboxLogic.Cities(sel.Name);
     }
 }