private void BtnCreate_Click(object sender, EventArgs e) { var lease = new RoomLeaseDTO(); lease.RoomID = this.tbRoomID.Text; lease.RoomTypeID = this.tbRoomType.Text; lease.RoomPrice = Int64.Parse(this.tbRoomPrice.Text.Split()[0].Replace(",", "")); lease.LeaseDate = DateTime.ParseExact(tbRoomDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture).ToString("d"); if (RoomLeaseBUS.InsertRoomLease(lease)) { RoomLeaseDetailDTO detail = new RoomLeaseDetailDTO(); detail.LeaseID = RoomLeaseBUS.GetLastLeaseIDOfRoom(lease.RoomID); foreach (DataGridViewRow row in dgvCustomerData.Rows) { detail.CustomerName = row.Cells["CustomerName"].Value.ToString(); detail.CustomerPassportID = row.Cells["CustomerPassportID"].Value.ToString(); detail.CustomerTypeID = Convert.ToInt32(row.Cells["CustomerTypeID"].Value); detail.CustomerAddress = row.Cells["CustomerAddress"].Value.ToString(); RoomLeaseDetailBUS.InsertDetail(detail); } MainForm mainForm = (MainForm)Owner; mainForm.ReLoadAvailableRoom(); mainForm.ReLoadRoomData(); mainForm.ReCreateLease(); MessageBox.Show("Lập phiếu thuê phòng " + lease.RoomID + " thành công!", "LẬP PHIẾU THUÊ PHÒNG THÀNH CÔNG", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.Close(); }
//Tab 06: Room-Rule Edit private void ReLoadRuleRoom() { this.lbMaxCustomerValue.Text = RoomBUS.GetMaxCustomerInRoom().ToString(); this.lbAdditionalCustomerSurchargeValue.Text = RoomLeaseBUS.GetOverCustomerTaxPercent().ToString() + "%"; this.lbForeignCustomerSurchargeValue.Text = RoomLeaseBUS.GetForeignCustomerTaxPercent().ToString() + "%"; this.dgvCustomerType.DataSource = CustomerTypeBUS.GetCustomerTypeList(); var dt = RoomTypeBUS.GetRoomTypeList(); foreach (DataRow dr in dt.Rows) { this.dgvRoomType.Rows.Add (dr["MaLoaiPhong"].ToString(), Convert.ToInt64(dr["DonGia"]).ToString("N0")); } }
private void BtnCreate_Click(object sender, EventArgs e) { if (this.tbChange.Text[0] == '-') { MessageBox.Show( "Số tiền nhận chưa đủ tiền thanh toán", "THANH TOÁN HOÁ ĐƠN THẤT BẠI", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { var BillDate = DateTime.ParseExact(this.tbBillDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture); var bill = new RoomBillDTO(); bill.BillDate = DateTime.ParseExact(this.tbBillDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture).ToString("d"); bill.CustomerName = this.tbBillCustomer.Text; bill.CustomerAddress = this.tbBillAddress.Text; bill.BillCost = Convert.ToInt64(this.tbBillPrice.Text.Replace(",", "")); RoomBillBUS.InsertBill(bill); foreach (DataGridViewRow row in this.dgvBillData.Rows) { var roomID = row.Cells["PaidRoomID"].Value.ToString(); var price = Convert.ToInt64(row.Cells["PaidRoomTotalPrice"].Value.ToString().Replace(",", "")); RoomLeaseBUS.InsertRoomLeasePayment(roomID, price); } MainForm mainForm = (MainForm)Owner; mainForm.ReLoadRoomData(); mainForm.ReLoadAvailableRoom(); mainForm.ReCreateBill(); MessageBox.Show( "Thanh toán hoá đơn thành công", "THANH TOÁN HOÁ ĐƠN THÀNH CÔNG", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
void LoadRentRoom() { var BillDate = DateTime.ParseExact(deBillDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture); var dt = RoomLeaseBUS.GetRentedRoomList(BillDate.ToString("d")); if (dt.Rows.Count == 0) { MessageBox.Show( "Không có phòng nào được thuê trước ngày " + deBillDate.Text, "KHÔNG CÓ PHÒNG ĐANG THUÊ", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { foreach (DataRow row in dt.Rows) { this.cbAddBillRoomID.Items.Add(row["MaPhong"]); } this.cbAddBillRoomID.SelectedIndex = 0; this.btnLockBill.Enabled = false; } }
private void BtnConfirm_Click(object sender, EventArgs e) { if (RoomLeaseBUS.UpdateOverCustomerTaxPercent(Convert.ToInt16(this.nudTaxPercent.Value))) { MessageBox.Show( "Chỉnh sửa số phụ thu khách thêm thành công!\n" + "Lưu ý: Phụ thu tối đa có thể quy định là " + this.nudTaxPercent.Maximum.ToString() + "%", "CHỈNH SỬA THÀNH CÔNG!", MessageBoxButtons.OK, MessageBoxIcon.Information); var mainForm = (MainForm)Owner; mainForm.ReLoadOverCustomerTax(); this.Close(); } else { MessageBox.Show( "Chỉnh sửa phụ thu khách thêm thất bại!", "CHỈNH SỬA THẤT BẠI!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void ReLoadForeignCustomerTax() { this.lbForeignCustomerSurchargeValue.Text = RoomLeaseBUS.GetForeignCustomerTaxPercent().ToString() + "%"; }
public void ReLoadOverCustomerTax() { this.lbAdditionalCustomerSurchargeValue.Text = RoomLeaseBUS.GetOverCustomerTaxPercent().ToString() + "%"; }