コード例 #1
0
        public void Update()
        {
            try
            {
                animalHandler = new AnimalsHandler();
                List <Cattle> updatedList = datagridAnimal.Items.OfType <Cattle>().ToList();

                foreach (Cattle record in updatedList)
                {
                    animalHandler.Update(record);
                }
            }
            catch (Exception exp)
            {
                MessageBoxResult result = MessageBox.Show(exp.Message,
                                                          "Do you want to correct it or Restore to the original content?",
                                                          MessageBoxButton.YesNo);

                if (result == MessageBoxResult.Yes)
                {
                    return;
                }
                else
                {
                    Refresh();
                }


                return;
            }
        }
コード例 #2
0
        //List<Animal> animalList;        //Although we need to work for Cattle in the project, but polymorphism will allow animalList to contain Cattle objects. 02-Jan
        public AnimalEntryView()
        {
            InitializeComponent();

            //Added - 2 Jan, 2015

            animalHandler = new AnimalsHandler();
            //animalList = new List<Animal>();

            comboBoxAnimalType.ItemsSource = animalHandler.GetAnimalTypes();
            comboBoxBreed.ItemsSource      = animalHandler.GetAnimalBreeds();
            comboBoxSource.ItemsSource     = animalHandler.GetAnimalSources();

            //Commented on April-01
            //Statuses should be on the basis of the gender
            //comboBoxStatus.ItemsSource = animalHandler.GetAnimalStatuses();

            List <string> genderList = new List <string>();

            genderList.Add("Male");
            genderList.Add("Female");

            comboBoxGender.ItemsSource = genderList;

            //Commented on 31-March. Now Gender will not be FK anymore
            //comboBoxGender.ItemsSource = animalHandler.GetGenders();
        }
コード例 #3
0
        private void EntryGrid_Loaded(object sender, RoutedEventArgs e)
        {
            animalHandler = new AnimalsHandler();
            custHandler   = new CustomersHandler();

            //comboBoxMilkType.ItemsSource = animalHandler.GetAnimalTypes();
            //comboBoxPriceCategory.ItemsSource = custHandler.GetPriceCategories();
            //comboBoxTime.ItemsSource = custHandler.GetTimeCategories();
        }
コード例 #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            animalHandler = new AnimalsHandler();
            //animalList = new List<Animal>();

            //transactionList = new List<DBTransaction>();
            //transactionList.Add(new DBTransaction(DateTime.Now, GlobalSettings.CurrApplictionUser));

            //latestTransactionsItemControl.ItemsSource = transactionList;
        }
コード例 #5
0
 private void ComboBoxTagNo_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         animalHandler             = new AnimalsHandler();
         tagNoComboBox.ItemsSource = animalHandler.GetCattles_GivingMilk();
     }
     catch (Exception except)
     {
         MessageBox.Show("Error!", except.Message);
     }
 }
        public AnimalStatusEntryView()
        {
            InitializeComponent();
            animalHandler = new AnimalsHandler();
            comboBoxAnimal.ItemsSource = animalHandler.GetCattles();
            List <bool> booleanList = new List <bool>();

            booleanList.Add(true);
            booleanList.Add(false);

            comboBoxMilkingStatus.ItemsSource = booleanList;

            allStatusesList = animalHandler.GetAnimalStatuses();
            //IEnumerable<AnimalStatusNew> distinctStauses = allStatusesList.Distinct();
        }
コード例 #7
0
        //List<Animal> animalList;        //Although we need to work for Cattle in the project, but polymorphism will allow animalList to contain Cattle objects. 02-Jan
        public CalfEntryView()
        {
            InitializeComponent();

            //Added - 2 Jan, 2015

            animalHandler = new AnimalsHandler();
            //animalList = new List<Animal>();

            comboBoxAnimalType.ItemsSource = animalHandler.GetAnimalTypes();



            comboBoxBreed.ItemsSource  = animalHandler.GetAnimalBreeds();
            comboBoxSource.ItemsSource = animalHandler.GetAnimalSources();

            //Commented on 01-Apr. No Status required for Calf
            //comboBoxStatus.ItemsSource = animalHandler.GetAnimalStatuses();
            comboBoxGender.ItemsSource = animalHandler.GetGenders();

            //Added on 01-April - Add Artificial Insemination in Fathers Tab
            List <Cattle> maleCattleList = new List <Cattle>();

            maleCattleList = animalHandler.GetCattlesMale();

            Cattle artificialInsemnation = new Cattle();

            artificialInsemnation.TagNo = "Artificial Insemnation";

            maleCattleList.Add(artificialInsemnation);
            comboBoxFather.ItemsSource = maleCattleList;

            //Added on 02-April - Add Artificial Insemination in Fathers Tab
            List <Cattle> femaleCattleList = new List <Cattle>();

            femaleCattleList = animalHandler.GetCattlesFemale();

            Cattle otherFarm = new Cattle();

            otherFarm.TagNo = "Other Farm";

            femaleCattleList.Add(otherFarm);
            comboBoxMother.ItemsSource = femaleCattleList;
        }
コード例 #8
0
        public void Refresh()
        {
            animalHandler = new AnimalsHandler();

            datagridAnimal.ItemsSource = animalHandler.GetCattles();
        }
コード例 #9
0
        public void Refresh()
        {
            calfHandler = new AnimalsHandler();

            datagridCalf.ItemsSource = calfHandler.GetCalfs();
        }
コード例 #10
0
 /// <summary>
 /// Added on March 18
 /// </summary>
 /// <param name="col">Column Name</param>
 /// <param name="param">Column Value</param>
 public void ShowFilteredList(string col, string param)
 {
     calfHandler = new AnimalsHandler();
     datagridCalf.ItemsSource = calfHandler.GetCalfs(col, param);
 }