// //---- EVENTS // #region Events private void BtCheckIn_Click(object sender, EventArgs e) { TimeSpan a = dtCheckOut.Value.Subtract(dtCheckIn.Value); decimal x = a.Days + 1; decimal y = Decimal.Parse(lbCost.Text) * x; bllBUS = new BillBUS(); BillDTO bll = new BillDTO(); bll.IDB = lbNameCustomer.Text + "/" + dtCheckIn.Text + "/" + dtCheckOut.Text + "@" + lbNameCustomer.Text; bll.IDC = lbNameCustomer.Text; bll.IDR = lbNameRoom.Text; bll.CheckIn = DateTime.Parse(dtCheckIn.Text); bll.CheckOut = DateTime.Parse(dtCheckOut.Text); bll.COST = Decimal.Parse(lbCost.Text) * x; bool kq = bllBUS.add(bll); if (kq == false) { MessageBox.Show("Fail!"); } else { rmBUS = new RoomBUS(); RoomDTO rm = new RoomDTO(); rm.Idr = lbNameRoom.Text; rm.Status = "Có Khách"; bool kq1 = rmBUS.editStatus(rm); if (kq == false) { MessageBox.Show("Fail!"); } else { MessageBox.Show("Sussces"); } } this.Close(); }
private void btCheckOut_Click_1(object sender, EventArgs e) { srvBUS = new RoomServiceBUS(); RoomServiceDTO srv = new RoomServiceDTO(); srv.IDR = lbNameRoom.Text; bllBus = new BillBUS(); BillDTO bll = new BillDTO(); bll.IDC = lbNameCustomer.Text; bll.IDR = lbNameRoom.Text; bll.CheckIn = DateTime.Parse(lbCheckIn.Text); bll.CheckOut = DateTime.Parse(lbCheckOut.Text); lbCostRoom.Text = bll.COST.ToString(); bll.COST = Decimal.Parse(lbCostRoom.Text); bool kq = bllBus.editCost(bll); if (kq == false) { MessageBox.Show("Fail!"); } else { rmBUS = new RoomBUS(); RoomDTO rm = new RoomDTO(); rm.Idr = lbNameRoom.Text; rm.Status = "Trống"; bool kq1 = rmBUS.editStatus(rm); if (kq == false) { MessageBox.Show("Fail!"); } else { MessageBox.Show("Sussces"); } } this.Close(); }