Exemplo 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;
     }
 }
Exemplo n.º 2
0
 protected internal static CheckinForm Instance()
 {
     if (_instance == null)
     {
         _instance = new CheckinForm();
     }
     return(_instance);
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
0
 private void listView1_DoubleClick(object sender, EventArgs e)
 {
     if (CheckinForm._instance != null)
     {
         CheckinForm checkinForm = CheckinForm._instance;
         checkinForm.lblRoom.Text      = listView1.SelectedItems[0].Text.ToString();
         checkinForm.lblRoomType.Text  = listView1.SelectedItems[0].SubItems[1].Text.ToString();
         checkinForm.lblOccupancy.Text = listView1.SelectedItems[0].SubItems[3].Text.ToString();
         //checkinForm.updateCurrentPeople();
     }
     else
     {
         CheckOutForm checkOutForm = CheckOutForm._instance;
         checkOutForm.lblRoom.Text      = listView1.SelectedItems[0].Text.ToString();
         checkOutForm.lblRoomType.Text  = listView1.SelectedItems[0].SubItems[1].Text.ToString();
         checkOutForm.lblOccupancy.Text = listView1.SelectedItems[0].SubItems[3].Text.ToString();
     }
     this.Close();
 }
Exemplo n.º 5
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            if (CheckinForm._instance != null)
            {
                CheckinForm checkinForm = CheckinForm._instance;
                checkinForm.lblGuestID.Text  = listView1.SelectedItems[0].Text.ToString();
                checkinForm.txtLastName.Text = listView1.SelectedItems[0].SubItems[1].Text.ToString() + " " + listView1.SelectedItems[0].SubItems[2].Text.ToString();
                checkinForm.txtCMND.Text     = listView1.SelectedItems[0].SubItems[3].Text.ToString();
            }
            else
            {
                CheckOutForm checkOutForm = CheckOutForm._instance;
                checkOutForm.lblGuestID.Text = listView1.SelectedItems[0].Text.ToString();
                //checkOutForm.txtLastName.Text = listView1.SelectedItems[0].SubItems[1].Text.ToString() + " " + listView1.SelectedItems[0].SubItems[2].Text.ToString();
                //checkOutForm.txtCMND.Text = listView1.SelectedItems[0].SubItems[3].Text.ToString();
            }



            this.Close();
        }
Exemplo n.º 6
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();
            }
        }
Exemplo n.º 7
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);
            }
        }