private void buttonSearch_Click(object sender, EventArgs e)
        {
            List <string> TempOwnerList    = new List <string>();
            List <string> TempRelationList = new List <string>();
            List <string> TempAnimalList   = new List <string>();

            comboBoxAnimalChoice.Items.Clear();
            comboBoxTimeChoice.Items.Clear();
            comboBoxTimeChoice.Text = "";
            if (textBoxOwnerInput.TextLength == 0)
            {
                MessageBox.Show("Please put in a phone number for the owner");
                return;
            }
            if (Controller.ControllerOwnerExist(textBoxOwnerInput.Text) == false)
            {
                MessageBox.Show("No owner exist under that phone number");
                return;
            }

            TempOwnerList = Controller.ControllerGetOwner(textBoxOwnerInput.Text);

            textBoxOwnerPhoneInfo.Text  = TempOwnerList[0];
            textBoxOwnerNameInfo.Text   = TempOwnerList[1] + " " + TempOwnerList[2];
            textBoxOwnerStreetInfo.Text = TempOwnerList[3];
            textBoxOwnerEmailInfo.Text  = TempOwnerList[4];
            textBoxOwnerCityInfo.Text   = TempOwnerList[5];
            textBoxOwnerZipInfo.Text    = TempOwnerList[6];

            TempRelationList = Controller.ControllerGetRelation(textBoxOwnerInput.Text);

            AnimalArray = new string[TempRelationList.Count / 2, 7];
            for (int i = 0; i < TempRelationList.Count / 2; i++)
            {
                TempAnimalList = Controller.ControllerGetAnimal(TempRelationList[(i * 2) + 1]);
                for (int j = 0; j < 7; j++)
                {
                    AnimalArray[i, j] = TempAnimalList[j];
                }
                comboBoxAnimalChoice.Items.Add(AnimalArray[i, 1]);
            }
            comboBoxAnimalChoice.SelectedIndex = 0;
            SearchCheck = true;

            if (buttonUpdate.Visible == true)
            {
                buttonUpdate.Visible = false;
                buttonCreate.Visible = true;
            }
            else
            {
                buttonCreate.Visible = true;
            }
        }
Beispiel #2
0
 private void ButtonSearchOwner_Click(object sender, EventArgs e)
 {
     if (textBoxOwner.Text == "")
     {
         MessageBox.Show("Owner does not exist", "Error", MessageBoxButtons.OK);
     }
     else if (Controller.ControllerOwnerExist(textBoxOwner.Text) == true)
     {
         OwnerValidCheckBox.Checked = true;
         OwnerValidCheckBox.Enabled = false;
         if (Controller.ControllerCheckIfExsistInPrivateIsPrivate(textBoxOwner.Text) == true)
         {
             PrivateCheckBox.Checked  = true;
             BuisnessCheckBox.Checked = false;
         }
         else
         {
             PrivateCheckBox.Checked  = false;
             BuisnessCheckBox.Checked = true;
         }
     }
     else
     {
         OwnerValidCheckBox.Checked = false;
         OwnerValidCheckBox.Enabled = false;
     }
     foreach (string item in Controller.ControllerBookningFeetch(textBoxOwner.Text))
     {
         ComboBoxBookning.Items.Add(item);
     }
 }
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            List <string> TempBookningList = new List <string>();

            TempBookningList = Controller.ControllerGetBookning(textBoxBookingSearch.Text);

            if (textBoxBookingSearch.TextLength == 0)
            {
                MessageBox.Show("Please put in a phone number for the owner");
                return;
            }
            if (Controller.ControllerOwnerExist(textBoxBookingSearch.Text) == false)
            {
                MessageBox.Show("No owner exist under that phone number");
                return;
            }

            BookingArray = new string[TempBookningList.Count / 9, 9];
            for (int i = 0; i < TempBookningList.Count / 9; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    BookingArray[i, j] = TempBookningList[(i * 9) + j];
                }
                comboBoxBookningChoice.Items.Add(Convert.ToDateTime(TempBookningList[(i * 9) + 6]).ToString("dd-MM-yyyy") + " " + Controller.ControllerGetAnimal(TempBookningList[(i * 9) + 3])[1]);
            }
            comboBoxBookningChoice.SelectedIndex = BookingArray.Length / 9 - 1;
        }
Beispiel #4
0
        private void ButtonSearchOwner_Click(object sender, EventArgs e)
        {
            if (TextBoxTelephoneNR.Text == "")
            {
                MessageBox.Show("You are missing some blank spaces, fill them out please", "Error: Empty spaces", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (Controller.ControllerOwnerExist(TextBoxTelephoneNR.Text) == false)
            {
                MessageBox.Show("Does not exist!");
            }
            else if (BusinessCheck.Checked)
            {
                BusinessList            = Controller.ControllerSearchForBusiness(TextBoxTelephoneNR.Text);
                OwnerList               = Controller.ControllerSearchForOwner(TextBoxTelephoneNR.Text);
                Adresse                 = OwnerList[3].Split(' ');
                TextBoxTelephoneNR.Text = OwnerList[0];
                TextBoxFirstName.Text   = OwnerList[1];
                TextBoxLastName.Text    = OwnerList[2];
                if (ApartmentCheck.Checked)
                {
                    TextBoxStreet.Text = Adresse[0];
                    TextBoxNr.Text     = Adresse[1];
                    TextBoxFloor.Text  = Adresse[2];
                }
                else
                {
                    TextBoxStreet.Text   = Adresse[0];
                    TextBoxNr.Text       = Adresse[1];
                    label5.Visible       = true;
                    TextBoxFloor.Visible = true;
                }
                TextBoxEmail.Text       = OwnerList[4];
                TextBoxCity.Text        = OwnerList[5];
                TextBoxZipCode.Text     = OwnerList[6];
                TextBoxCompanyName.Text = BusinessList[1];
                TextBoxCVRNR.Text       = BusinessList[2];

                dataGridViewOwnerDyr.DataSource = Controller.ControllerShowAnimalDataTable(TextBoxTelephoneNR.Text);
            }
            else if (PrivateCheck.Checked)
            {
                OwnerList = Controller.ControllerSearchForOwner(TextBoxTelephoneNR.Text);
                Adresse   = OwnerList[3].Split(' ');
                TextBoxTelephoneNR.Text = OwnerList[0];
                TextBoxFirstName.Text   = OwnerList[1];
                TextBoxLastName.Text    = OwnerList[2];
                if (ApartmentCheck.Checked)
                {
                    TextBoxStreet.Text = Adresse[0];
                    TextBoxNr.Text     = Adresse[1];
                    TextBoxFloor.Text  = Adresse[2];
                }
                else
                {
                    TextBoxStreet.Text   = Adresse[0];
                    TextBoxNr.Text       = Adresse[1];
                    label5.Visible       = true;
                    TextBoxFloor.Visible = true;
                }
                TextBoxEmail.Text   = OwnerList[4];
                TextBoxCity.Text    = OwnerList[5];
                TextBoxZipCode.Text = OwnerList[6];

                dataGridViewOwnerDyr.DataSource = Controller.ControllerShowAnimalDataTable(TextBoxTelephoneNR.Text);
            }
        }