Пример #1
0
        private void Btn_Save_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(Txt_name1.Text) || String.IsNullOrEmpty(Txt_fname.Text) || String.IsNullOrEmpty(Txt_lname.Text))
            {
                MessageBox.Show("Please fill the information");
            }
            else
            {
                registers.Add(new register {
                    firstName = Txt_fname.Text, lastName = Txt_lname.Text, address = Txt_address.Text, city = Txt_city.Text, email = Txt_email.Text, telefon = Txt_telefon.Text, regdate = txtDatePicker.Text
                });
                //var pet = new pet { petname = Txt_name1.Text, petbreed = Cbo_breed1.SelectedItem.ToString(), petgender = Cbo_gender1.Text };
                pets.Add(new pet {
                    ownerName = Txt_fname.Text, petname = Txt_name1.Text, petbreed = Cbo_breed1.SelectedItem.ToString(), petgender = Cbo_gender1.Text
                });
                Mystorage.WriteToXmlFile <ObservableCollection <register> >("registers.xml", registers);
                Mystorage.WriteToXmlFile <ObservableCollection <pet> >("pets.xml", pets);
                pets = Mystorage.ReadFromXmlFile <ObservableCollection <pet> >("pets.xml");
                LBx_Pets.ItemsSource = from p in pets where p.ownerName == Txt_fname.Text
                                       select p;

                LBx_Owner.SelectedItem = registers;
                LBx_Pets.ItemsSource   = pets;
            }
        }
Пример #2
0
        private void LBx_Owner_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                pets = Mystorage.ReadFromXmlFile <ObservableCollection <pet> >("pets.xml");
                LBx_Pets.ItemsSource = from p in pets where p.ownerName == ((Pet_Training_App.register)LBx_Owner.SelectedItem).firstName select p;

                var date = (from r in registers where r.firstName == ((Pet_Training_App.register)LBx_Owner.SelectedItem).firstName select r.regdate).ToList();
                txtDatePicker.Text = date[0];
            }
            catch (Exception ex)
            {
                //throw;
            }
        }
Пример #3
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     registers   = Mystorage.ReadFromXmlFile <ObservableCollection <register> >("registers.xml");
     sessions    = Mystorage.ReadFromXmlFile <ObservableCollection <session> >("sessions.xml");
     attendances = Mystorage.ReadFromXmlFile <ObservableCollection <attendance> >("attendances.xml");;
     LBx_attendenceList.ItemsSource = attendances;
     //Cbo_class.ItemsSource = sessions;
     LBx_Owner.ItemsSource = registers;
     Genderfill();
     Breedfill();
     //Sessionfill();
     Daysfill();
     tclass();
     petsBinding();
     Statusfill();
 }
Пример #4
0
 public void attendenceBinding()
 {
     attendances = Mystorage.ReadFromXmlFile <ObservableCollection <attendance> >("attendances.xml");
     LBx_attendance.ItemsSource = attendances;
 }
Пример #5
0
 public void petsBinding()
 {
     pets = Mystorage.ReadFromXmlFile <ObservableCollection <pet> >("pets.xml");;
     LBx_OwnerPets.ItemsSource = pets;
 }