Example #1
0
 public AdministrationForm()
 {
     InitializeComponent();
     admin = new Administration();
     animalTypeComboBox.SelectedIndex = 0;
     nudChipNumber.Enabled            = true;
 }
 private void btnLoad_Click(object sender, EventArgs e)
 {
     try
     {
         Administration.Load(fileName);
     }
     catch (ArgumentNullException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (ArgumentException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (PathTooLongException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (FileNotFoundException ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         //update
     }
 }
Example #3
0
 /// <summary>
 /// Creates the form for doing adminstrative tasks
 /// </summary>
 public AdministrationForm()
 {
     InitializeComponent();
     cbAnimalType.SelectedIndex = 0;
     cbAnimal.DisplayMember     = "ChipRegistrationNumber";
     administration             = new Administration();
     StartAnimal();
 }
 /// <summary>
 /// Creates the form for doing adminstrative tasks
 /// </summary>
 public AdministrationForm()
 {
     InitializeComponent();
     animalTypeComboBox.SelectedIndex = 0;
     administration = new Administration();
     administration.ReadAnimals(false);
     Database.Initialize();
 }
 /// <summary>
 /// Creates the form for doing adminstrative tasks
 /// </summary>
 public AdministrationForm()
 {
     InitializeComponent();
     animalTypeComboBox.SelectedIndex = 0;
     administration = new Administration();
     administration.ReadAnimals(false);
     Database.Initialize();
 }
Example #6
0
 /// <summary>
 /// Creates the form for doing adminstrative tasks
 /// </summary>
 public AdministrationForm()
 {
     InitializeComponent();
     animalTypeComboBox.SelectedIndex = 0;
     admin = new Administration();
     foreach (Animal animal in admin.Animals)
     {
         animalBox.Items.Add(animal);
     }
 }
 public AdministrationForm()
 {
     InitializeComponent();
     Administration = new Administration();
     Administration.Animals.Add(new Dog(1, new SimpleDate(21, 5, 1999), "Bello", new SimpleDate(18, 02, 2016)));
     Administration.Animals.Add(new Cat(2, new SimpleDate(3, 9, 2010), "Felix", "Grumpy"));
     Administration.Animals.Add(new Cat(3, new SimpleDate(17, 12, 1995), "Poekie", ""));
     Administration.Animals.Add(new Dog(5, new SimpleDate(6, 7, 2005), "Blaffie", new SimpleDate(29, 9, 2015)));
     RefreshFormInputFields(Refreshes.EnumReserveAnimal);
     Administration.Export(exportFile);
     RefreshForm = new Refreshes();
 }
        private void btnFindAnimal_Click(object sender, EventArgs e)
        {
            int result;

            if (Int32.TryParse(tbFindAnimal.Text, out result))
            {
                lblFindAnimalResult.Text = Administration.FindAnimal(result).ToString();
                RefreshForm = Refreshes.EnumReserveAnimal;
                RefreshFormInputFields(RefreshForm);
            }
            else
            {
                MessageBox.Show("U heeft geen geldig chip registratie nummer ingevoerd");
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int result;

            if (Int32.TryParse(nudChipRegistrationNumber.Text, out result))
            {
                Administration.RemoveAnimal(result);
                RefreshForm = Refreshes.EnumReserveAnimal;
                RefreshFormInputFields(RefreshForm);
            }
            else
            {
                MessageBox.Show("U heeft geen geldig chip registratie nummer ingevoerd");
            }
        }
Example #10
0
        private void IsReserved(bool isReserved)
        {
            Animal animal = Administration.FindAnimal((int)nudChipRegistrationNumber.Value);

            if (animal != null)
            {
                if (isReserved == true)
                {
                    animal.IsReserved = true;
                }
                else
                {
                    animal.IsReserved = false;
                }
            }
        }
Example #11
0
        private void createAnimalButton_Click(object sender, EventArgs e)
        {
            bool addingSuccesfull = false;
            int  chipRegistrationNumber;
            bool correctChipRegistrationNumber = Int32.TryParse(tbChipRegistrationNumber.Text, out chipRegistrationNumber);

            if (correctChipRegistrationNumber)
            {
                if (rbCat.Checked)
                {
                    Animal cat = new Cat(chipRegistrationNumber, new SimpleDate(dtpDateOfBirth.Value.Day, dtpDateOfBirth.Value.Month, dtpDateOfBirth.Value.Year), tbName.Text, tbBadHabits.Text);
                    addingSuccesfull = Administration.Add(cat);
                    if (addingSuccesfull)
                    {
                        lbUnreserved.Items.Add(cat);
                    }
                    RefreshForm = Refreshes.EnumAddAnimal;
                    RefreshFormInputFields(RefreshForm);
                }
                else if (rbDog.Checked)
                {
                    Animal dog = new Dog(chipRegistrationNumber, new SimpleDate(dtpDateOfBirth.Value.Day, dtpDateOfBirth.Value.Month, dtpDateOfBirth.Value.Year), tbName.Text, new SimpleDate(dtpLastWalkDate.Value.Day, dtpLastWalkDate.Value.Month, dtpLastWalkDate.Value.Year));
                    addingSuccesfull = Administration.Add(dog);
                    if (addingSuccesfull)
                    {
                        lbUnreserved.Items.Add(dog);
                    }
                    RefreshForm = Refreshes.EnumAddAnimal;
                    RefreshFormInputFields(RefreshForm);
                }
                else
                {
                    MessageBox.Show("Er is geen Kat of Hond geselecteerd");
                }
            }
            else
            {
                MessageBox.Show("U heeft niet alleen getallen ingevoerd");
            }
        }
Example #12
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         Administration.Save(fileName);
     }
     catch (ArgumentNullException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (ArgumentException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (PathTooLongException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (FileNotFoundException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 /// <summary>
 /// Creates the form for doing adminstrative tasks
 /// </summary>
 public AdministrationForm()
 {
     Administration = new Administration();
     animal         = new Cat(RegNummer++, new SimpleDate(1, 04, 2018), "Klaartje", "");
     Administration.Add(animal);
     animal = new Cat(RegNummer++, new SimpleDate(12, 8, 2014), "Puck", "");
     Administration.Add(animal);
     animal = new Cat(RegNummer++, new SimpleDate(21, 11, 2016), "Bor", "");
     Administration.Add(animal);
     animal = new Dog(RegNummer++, new SimpleDate(6, 5, 2013), "Kinga", new SimpleDate(1, 1, 1980));
     Administration.Add(animal);
     animal = new Dog(RegNummer++, new SimpleDate(17, 12, 2016), "Bijke", new SimpleDate(1, 1, 1980));
     Administration.Add(animal);
     InitializeComponent();
     animalTypeComboBox.SelectedIndex = 0;
     textBoxBadHabits.Visible         = true;
     LabelHabits.Visible = true;
     labelWalked.Visible = false;
     numericUpDownLastDayWalked.Visible        = false;
     numericUpDownLastWallkedYear.Visible      = false;
     numericUpDownLastMonthWalkedMonth.Visible = false;
     animal = null;
     UpdateListbox();
 }
 public void Initialize()
 {
     simpleDate = new SimpleDate(06, 11, 1996);
     lastWalk = new SimpleDate(06, 11, 1996);
     administration = new Administration();
     dog = new Dog("12345", simpleDate, "testdog", lastWalk);
     cat = new Cat("12345", simpleDate, "testcat", "0123456789");
 }