示例#1
0
文件: Form1.cs 项目: rozytwan/POS
 private void bunifuFlatButton5_Click(object sender, EventArgs e)
 {
     Hotel.Hotel rp = new Hotel.Hotel();
     panel1.Controls.Clear();
     panel1.Controls.Add(rp);
     bunifuFlatButton5.BackColor = Color.FromArgb(10, 24, 45);
     bunifuFlatButton1.BackColor = Color.Transparent;
     bunifuFlatButton2.BackColor = Color.Transparent;
     bunifuFlatButton9.BackColor = Color.Transparent;
     bunifuFlatButton4.BackColor = Color.Transparent;
     bunifuFlatButton6.BackColor = Color.Transparent;
     bunifuFlatButton7.BackColor = Color.Transparent;
     bunifuFlatButton8.BackColor = Color.Transparent;
     bunifuFlatButton3.BackColor = Color.Transparent;
 }
示例#2
0
        private void bunifuFlatButton3_Click(object sender, EventArgs e)
        {
            int pending_booking_id = PendingBooking.pending_booking_id;

            byte[]         img    = null;
            ImageConverter imgCon = new ImageConverter();

            img = (byte[])imgCon.ConvertTo(customer_pic.Image, typeof(byte[]));

            if (txt_fname.Text == "" || txt_lname.Text == "" || txt_mobile.Text == "" || txt_country.Text == "")
            {
                MessageBox.Show("Your Information is not Completed", "Confirm Information Alert !!");
            }
            else
            {
                if (customer_id == 0)
                {
                    if (rbn_female.Checked == true)
                    {
                        gender = "Female";
                    }
                    else if (rbn_male.Checked == true)
                    {
                        gender = "Male";
                    }
                    else
                    {
                        gender = "Others";
                    }
                    int insert_customer = hotel.Insert_Customer(txt_fname.Text, txt_lname.Text, txt_mobile.Text, txt_country.Text, txt_email.Text, gender, txt_house.Text, txt_city.Text, txt_state.Text, txt_id_type.Text, txt_id_number.Text, img, Convert.ToDateTime(dtp_birth.Text));
                    int insertinto      = custor.insertintotables(img, txt_fname.Text, txt_lname.Text, Convert.ToDateTime(dtp_birth.Text), gender, txt_city.Text, txt_mobile.Text, "", txt_city.Text, txt_country.Text, txt_id_type.Text, txt_id_number.Text, txt_email.Text, "Hotel Cusomter", "", "");

                    DataTable dt = hotel.GetID(txt_fname.Text, txt_lname.Text);
                    customer_id = Convert.ToInt32(dt.Rows[0]["customer_id"].ToString());
                    if (txt_come.Text != "" || txt_go.Text != "" || txt_visit.Text != "")
                    {
                        int insert_details = hotel.Insert_Customer_details(customer_id, txt_come.Text, txt_go.Text, txt_visit.Text);
                    }
                    if (lbl_room_no.Text != "" && lbl_room_no.Text != "0")
                    {
                        int insert_booking = hotel.Insert_Booking(customer_id, Convert.ToDateTime(today), Convert.ToDateTime(dtp_check_in.Text), cmb_room_type.Text, Convert.ToInt32(txt_guest.Text), Convert.ToDateTime(dtp_checkout.Text), txt_roomno.Text, room_id, 0);
                        int delete         = pend.CancelationCustomer(Convert.ToInt32(customer_id));
                        MessageBox.Show("Your hotel have been Reserved", "Hotel Reserved Alert !!");
                    }
                    else
                    {
                        int insert_booking = hotel.Insert_Pending_booking(customer_id, Convert.ToDateTime(today), Convert.ToDateTime(dtp_check_in.Text), cmb_room_type.Text, Convert.ToInt32(txt_guest.Text), Convert.ToDateTime(dtp_checkout.Text), txt_roomno.Text, lbl_room_no.Text, username, Convert.ToDateTime(today));
                        MessageBox.Show("Your hotel have been Booked", "Hotel Booking Alert !!");
                    }
                }
                else
                {
                    if (txt_come.Text != "" || txt_go.Text != "" || txt_visit.Text != "")
                    {
                        int insert_details = hotel.Insert_Customer_details(customer_id, txt_come.Text, txt_go.Text, txt_visit.Text);
                    }
                    if (lbl_room_no.Text != "" && lbl_room_no.Text != "0")
                    {
                        if (cmb_package.Text == "Choose Package")
                        {
                            cmb_package.SelectedValue = 0;
                        }
                        int insert_booking = hotel.Insert_Booking(customer_id, Convert.ToDateTime(today), Convert.ToDateTime(today), cmb_room_type.Text, Convert.ToInt32(txt_guest.Text), Convert.ToDateTime(dtp_checkout.Text), txt_roomno.Text, room_id, Convert.ToInt32(cmb_package.SelectedValue));
                        // int updateroom = category.UpdateRoombyid(Convert.ToInt32(room_id));
                        DataTable dt = pend.GetpendingDetails(pending_booking_id);
                        if (Convert.ToInt32(dt.Rows[0]["no_of_room"].ToString()) > 1)
                        {
                            int updatepending = pend.Updatepending(pending_booking_id);
                        }
                        else
                        {
                            int delete = pend.CancelationCustomer(Convert.ToInt32(customer_id));
                            MessageBox.Show("Your hotel have been Reserved", "Hotel Reserved Alert !!");
                        }
                    }
                }

                Hotel.Hotel hko = new Hotel.Hotel();
                Control     crl = this.Parent;
                crl.Controls.Clear();
                crl.Controls.Add(hko);
            }
        }