private void btnCheckout_Click(object sender, EventArgs e) { int check = checkRoomState(); if (check == 1)//Đang sử dụng -> checkout { HomeForm hf = HomeForm.Instance(); CheckOutForm cof = CheckOutForm.Instance(); if (!hf.panel3.Controls.Contains(cof)) { hf.panel3.Controls.Add(cof); cof.Dock = DockStyle.Fill; cof.BringToFront(); cof.Visible = true; cof.lblRoom.Text = lblRoom.Text.ToString(); cof.lblRoomType.Text = lblRoomType.Text.ToString(); cof.lblOccupancy.Text = lblPCount.Text.ToString(); cof.lblCurrentPeopleCount.Text = lblCurrentP.Text.ToString(); CheckOutForm._instance.getCheckinDay(); CheckOutForm._instance.getTransID(); CheckOutForm._instance.load_All(); CheckOutForm._instance.txtCASH.Clear(); CheckOutForm._instance.txtChanges.Clear(); this.Hide(); } else { cof.BringToFront(); cof.Visible = true; cof.lblRoom.Text = lblRoom.Text.ToString(); cof.lblRoomType.Text = lblRoomType.Text.ToString(); cof.lblOccupancy.Text = lblPCount.Text.ToString(); cof.lblCurrentPeopleCount.Text = lblCurrentP.Text.ToString(); CheckOutForm._instance.getCheckinDay(); CheckOutForm._instance.getTransID(); CheckOutForm._instance.load_All(); CheckOutForm._instance.txtCASH.Clear(); CheckOutForm._instance.txtChanges.Clear(); this.Hide(); } } else if (check == 2) //đã đặt trước ->không được checkout { MessageBox.Show("Phòng đã đặt trước!!!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { MessageBox.Show("Phòng trống!!!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }
protected internal static CheckOutForm Instance() { if (_instance == null) { _instance = new CheckOutForm(); } return(_instance); }
private void btnCheckOut_Click(object sender, EventArgs e) { if (!panel3.Controls.Contains(CheckOutForm.Instance())) { panel3.Controls.Add(CheckOutForm._instance); CheckOutForm._instance.Dock = DockStyle.Fill; CheckOutForm._instance.BringToFront(); CheckOutForm._instance.Visible = true; } CheckOutForm._instance.BringToFront(); CheckOutForm._instance.Visible = true; }
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(); }
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(); }
private void btnUpdate_Click(object sender, EventArgs e) { update_Guest(); GuestListForm.Instance().load_GuestList(); CheckOutForm.Instance().load_All(); }