Esempio n. 1
0
 private void checkReserve()
 {
     try
     {
         using (con = new SqlConnection(cs))
             using (cmd = new SqlCommand("SELECT HoDem,Ten,CMND FROM DAT_TRUOC WHERE MaPhong=@maphong AND TrangThai=@state", con))
             {
                 con.Open();
                 cmd.Parameters.AddWithValue("@maphong", lblRoom.Text);
                 cmd.Parameters.AddWithValue("@state", "Đang đặt");
                 rdr = cmd.ExecuteReader();
                 if (rdr.Read())
                 {
                     CheckinForm.Instance().txtLastName.Text = rdr["HoDem"].ToString().Trim();
                     CheckinForm.Instance().txtFirstName.Text = rdr["Ten"].ToString().Trim();
                     CheckinForm.Instance().txtCMND.Text = rdr["CMND"].ToString().Trim();
                 }
                 else
                 {
                     CheckinForm.Instance().txtLastName.Text = "";
                     CheckinForm.Instance().txtFirstName.Text = "";
                     CheckinForm.Instance().txtCMND.Text = "";
                 }
                 rdr.Close();
             }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         throw;
     }
 }
Esempio n. 2
0
 private void btnCheckin_Click(object sender, EventArgs e)
 {
     if (!panel3.Controls.Contains(CheckinForm.Instance()))
     {
         panel3.Controls.Add(CheckinForm._instance);
         CheckinForm._instance.Dock = DockStyle.Fill;
         CheckinForm._instance.BringToFront();
         CheckinForm._instance.Visible = true;
     }
     CheckinForm._instance.BringToFront();
     CheckinForm._instance.Visible = true;
 }
Esempio n. 3
0
        private void btnCheckin_Click(object sender, EventArgs e)
        {
            HomeForm    hf = HomeForm.Instance();
            CheckinForm cf = CheckinForm.Instance();

            if (!hf.panel3.Controls.Contains(cf))
            {
                hf.panel3.Controls.Add(cf);
                cf.Dock = DockStyle.Fill;
                cf.BringToFront();
                cf.Visible = true;

                cf.lblRoom.Text     = lblRoom.Text.ToString();
                cf.lblRoomType.Text = lblRoomType.Text.ToString();

                cf.lblOccupancy.Text          = lblPCount.Text.ToString();
                cf.lblCurrentPeopleCount.Text = lblCurrentP.Text.ToString();

                checkReserve();

                this.Hide();
            }
            else
            {
                cf.BringToFront();
                cf.Visible          = true;
                cf.lblRoom.Text     = lblRoom.Text.ToString();
                cf.lblRoomType.Text = lblRoomType.Text.ToString();

                cf.lblOccupancy.Text          = lblPCount.Text.ToString();
                cf.lblCurrentPeopleCount.Text = lblCurrentP.Text.ToString();
                checkReserve();

                this.Hide();
            }
        }
Esempio n. 4
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            int temp = checkStatus(this.listView1.SelectedItems[0].SubItems[7].Text.ToString());

            //0-Đang đặt 1-HUỶ 2-Đã Checkin
            if (temp == 0)
            {
                DialogResult dr = MessageBox.Show("Bạn có muốn CHECKIN ?", "Information", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    HomeForm    hf = HomeForm.Instance();
                    CheckinForm cf = CheckinForm.Instance();
                    if (!hf.panel3.Controls.Contains(cf))
                    {
                        hf.panel3.Controls.Add(cf);
                        cf.Dock = DockStyle.Fill;
                        cf.BringToFront();
                        cf.Visible = true;

                        getRoomData(listView1.SelectedItems[0].SubItems[4].Text.ToString());

                        cf.lblRoom.Text               = listView1.SelectedItems[0].SubItems[4].Text.ToString();
                        cf.txtCMND.Text               = listView1.SelectedItems[0].SubItems[3].Text.ToString();
                        cf.txtLastName.Text           = listView1.SelectedItems[0].SubItems[1].Text.ToString();
                        cf.txtFirstName.Text          = listView1.SelectedItems[0].SubItems[2].Text.ToString();
                        cf.lblOccupancy.Text          = tempRoomOccu.ToString();
                        cf.lblCurrentPeopleCount.Text = tempRoomCurr.ToString();
                        cf.lblRoomType.Text           = tempRoomType;

                        this.Hide();
                    }
                    else
                    {
                        cf.BringToFront();
                        cf.Visible = true;


                        getRoomData(listView1.SelectedItems[0].SubItems[4].Text.ToString());
                        cf.lblRoom.Text               = listView1.SelectedItems[0].SubItems[4].Text.ToString();
                        cf.txtCMND.Text               = listView1.SelectedItems[0].SubItems[3].Text.ToString();
                        cf.txtLastName.Text           = listView1.SelectedItems[0].SubItems[1].Text.ToString();
                        cf.txtFirstName.Text          = listView1.SelectedItems[0].SubItems[2].Text.ToString();
                        cf.lblOccupancy.Text          = tempRoomOccu.ToString();
                        cf.lblCurrentPeopleCount.Text = tempRoomCurr.ToString();
                        cf.lblRoomType.Text           = tempRoomType;

                        this.Hide();
                    }
                }
                else if (dr == DialogResult.No)
                {
                    DialogResult dialog = MessageBox.Show("Bạn muốn HUỶ?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (dialog == DialogResult.Yes)
                    {
                        cancel_Reservation(listView1.SelectedItems[0].SubItems[4].Text.ToString(), listView1.SelectedItems[0].SubItems[3].Text.ToString());
                        RoomListForm.Instance().load_RoomList();
                        load_ReservationList();
                        GuestListForm.Instance().load_GuestList();
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            else if (temp == 1) //HUỶ
            {
                MessageBox.Show("Khách hàng đã huỷ ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else // Đã checkin
            {
                MessageBox.Show("Khách hàng đã CHECKIN ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }