Esempio n. 1
0
        private void btnTotal_Click(object sender, EventArgs e)
        {
            if (ValidationRoomRes.validateDiscountText(txtDiscount.Text))
            {
                double discount;

                if (!txtDiscount.Text.Equals(""))
                {
                    discount = Double.Parse(txtDiscount.Text);
                }
                else
                {
                    discount = 1;
                }
                //  double price = Double.Parse(lblPrice1.Text) * Int32.Parse(cmbRoom.Text);
                double discountPrice = Double.Parse(lblPrice1.Text) * (Int32.Parse(cmbSuiteRoom.Text) + Int32.Parse(cmbSuiteRoom.Text) + Int32.Parse(cmbStandardRoom.Text)) * discount / 100;
                double totalPrice    = (Double.Parse(lblPrice1.Text) * (Int32.Parse(cmbSuiteRoom.Text) + Int32.Parse(cmbSuiteRoom.Text) + Int32.Parse(cmbStandardRoom.Text))) - discountPrice;
                lblTotal1.Text = totalPrice.ToString();
            }
            else
            {
                MessageBox.Show("Disount should be a number between 0 and 100", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
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();
            }
        }