예제 #1
0
        /*    private void cmbRoom_SelectedIndexChanged(object sender, EventArgs e)
         *  {
         *      ComboBox cb = (ComboBox)sender;
         *      if (!cb.Text.Contains(cmbSuiteRoom.Text))
         *      {
         *          MessageBox.Show("no item is selected");
         *      }
         *  }
         */


        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtboxFirstName.Text == "" || txtboxLastName.Text == "" || textBoxNIC.Text == "" || txtboxAddress.Text == "" || txtboxContactNumber.Text == "" || adults.Text == "" || children.Text == "")
            {
                MessageBox.Show("Please fill the fields");
            }



            else if (!ValidationRoomRes.validateName(txtboxFirstName.Text) || txtboxFirstName.Text.Equals(String.Empty))
            {
                MessageBox.Show("Please enter a valid first Name");
            }
            else if (!ValidationRoomRes.validateName(txtboxLastName.Text) || txtboxLastName.Text.Equals(String.Empty))
            {
                MessageBox.Show("Please enter a valid Last Name");
            }
            else if (!ValidationRoomRes.validateNIC(textBoxNIC.Text) || textBoxNIC.Text.Equals(String.Empty))
            {
                MessageBox.Show("Please enter a valid NIC");
            }

            else if (!ValidationRoomRes.validatePhoneNo(txtboxContactNumber.Text) || txtboxContactNumber.Text.Equals(String.Empty))
            {
                MessageBox.Show("Please enter a valid Phone number");
            }
            else if (!ValidationRoomRes.validateNumbers(adults.Text) || adults.Text.Equals(String.Empty))
            {
                MessageBox.Show("Please enter  number of adults 1 - 12");
            }
            else if (!ValidationRoomRes.validateChildren(children.Text) || children.Text.Equals(String.Empty))
            {
                MessageBox.Show("Please enter  number of children  0-12");
            }
            else if (cmbDeluxeRoom.Text == "" && cmbSuiteRoom.Text == "" && cmbStandardRoom.Text == "")
            {
                MessageBox.Show("Please enter number of rooms");
            }

            else if (!radioMale.Checked && !radioFemale.Checked)
            {
                MessageBox.Show("You forgot to select the gender!");
            }
            else
            {
                ContactClass c = new ContactClass();
                //c.ContactID = Int32.Parse(txtboxContactID.Text);
                c.FirstName = txtboxFirstName.Text;
                c.LastName  = txtboxLastName.Text;
                c.NIC       = textBoxNIC.Text;
                c.ContactNo = txtboxContactNumber.Text;
                c.Address   = txtboxAddress.Text;
                String gender = "";

                if (radioMale.Checked)
                {
                    gender = "Male";
                }
                else if (radioFemale.Checked)
                {
                    gender = "Female";
                }

                c.Gender   = gender;
                c.checkin  = dob.Value.ToShortDateString();
                c.checkout = dateTimePicker1.Value.ToShortDateString();

                c.adults       = adults.Text;
                c.children     = children.Text;
                c.DeluxeRoom   = cmbDeluxeRoom.Text;
                c.SuiteRoom    = cmbSuiteRoom.Text;
                c.StandardRoom = cmbStandardRoom.Text;

                // c.Room = cmbRoom.Text;
                // c.Room = Int32.Parse(cmbSuiteRoom.Text);

                c.InsertCustomer();
                //   getRoomPrice();

                dgvAllCustomers.DataSource = loadAllCustomers();
            }
        }
예제 #2
0
        private void btnSubmit_Click_1(object sender, EventArgs e)
        {
            if (txtboxFirstName.Text == "" || txtboxLastName.Text == "" || txtboxAddress.Text == "" || txtboxContactNumber.Text == "" || cmbRoomType.Text == "" || cmbRoom.Text == "")
            {
                MessageBox.Show("Please fill the fields");
            }



            else if (!Validation.validateName(txtboxFirstName.Text) || txtboxFirstName.Text.Equals(String.Empty))
            {
                MessageBox.Show("Please enter a valid first Name");
            }
            else if (!Validation.validateName(txtboxLastName.Text) || txtboxLastName.Text.Equals(String.Empty))
            {
                MessageBox.Show("Please enter a valid Last Name");
            }
            else if (!Validation.validatePhoneNo(txtboxContactNumber.Text) || txtboxContactNumber.Text.Equals(String.Empty))
            {
                MessageBox.Show("Please enter a valid Phone number");
            }
            else if (cmbRoomType.Text == "")
            {
                MessageBox.Show("Please enter a valid Room Type");
            }

            else if (!radioMale.Checked && !radioFemale.Checked)
            {
                MessageBox.Show("You forgot to select the gender!");
            }
            else
            {
                ContactClass c = new ContactClass();
                //c.ContactID = Int32.Parse(txtboxContactID.Text);
                c.FirstName = txtboxFirstName.Text;
                c.LastName  = txtboxLastName.Text;
                c.ContactNo = txtboxContactNumber.Text;
                c.Address   = txtboxAddress.Text;
                String gender = "";

                if (radioMale.Checked)
                {
                    gender = "Male";
                }
                else if (radioFemale.Checked)
                {
                    gender = "Female";
                }

                c.Gender      = gender;
                c.DateOfBirth = dob.Value.ToShortDateString();

                c.RoomType = cmbRoomType.Text;
                // c.Room = cmbRoom.Text;
                c.Room = Int32.Parse(cmbRoom.Text);

                c.InsertCustomer();
                getRoomPrice();

                dgvAllCustomers.DataSource = loadAllCustomers();
            }

            //clearAddCustomerForm();
        }