private void btnThucHienTraDia_Click(object sender, EventArgs e) { try { DialogResult result = MessageBox.Show("Xác nhận trả đĩa", "Trả đĩa", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { ThucHienTraDia(); } var customer = new CustomerBUL().GetCustomer(Int32.Parse(txtMaKH.Text.ToString())); var lstLate = new ListRentedBUL().ListLate(customer.IdCustomer); if (lstLate.Count > 0) { DialogResult result1 = MessageBox.Show("Khách hàng có khoản trễ hạn. Có muốn thực hiện thanh toán không?", "Phí trễ hạn", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result1 == DialogResult.Yes) { FormThanhToan frm = new FormThanhToan(customer, lstLate, this.auth); frm.Show(); frm.FormClosing += Frm_FormClosing; } } } catch (Exception) { MessageBox.Show("Kiểm tra lại thông tin trả đĩa", "Trả đĩa", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public FormThueDia(string auth) { InitializeComponent(); dbCus = new CustomerBUL(); dbRented = new ListRentedBUL(); db = ExpressionMethod.DBDiskRent(); this.binding = new BindingSource(); this.auth = auth; }
public FormThanhToan(Customer customer, List <ListRented> lstRented, string auth) { InitializeComponent(); this.customer = customer; this.lstRented = lstRented; this.auth = auth; db = new ListRentedBUL(); }
public FormTraDia(string auth) { InitializeComponent(); dbListRented = new ListRentedBUL(); db = ExpressionMethod.DBDiskReturn(); binding = new BindingSource(); binding.DataSource = new List <DiskInfoReturn>(); this.auth = auth; }
public FormBaoCao() { InitializeComponent(); dbTitle = new TitleBUL(); dbRented = new ListRentedBUL(); dbCustomer = new CustomerBUL(); dbListPre = new ListTitlePreOrderBUL(); dbDisk = new DiskBUL(); bindingTitle = new BindingSource(); bindingCustomer = new BindingSource(); }
/// <summary> /// Trả về cái list có return db join từ 3 bảng và thông tin của khách hahgnf đó /// </summary> /// <returns></returns> public static List<DiskInfoReturn> DBDiskReturn() { List<DiskInfoReturn> lst = new List<DiskInfoReturn>(); CustomerBUL dbCustomer = new CustomerBUL(); TitleBUL dbTitle = new TitleBUL(); DiskBUL dbDisk = new DiskBUL(); ListRentedBUL dbRented = new ListRentedBUL(); var db = dbRented.GetListRenteds().Where(x => x.StatusOnBill == null) .Join(dbDisk.GetDisks(), rt => rt.IdDisk, d => d.IdDisk, (rt, d) => new { rt, d }) .Join(dbTitle.GetTitles(), rtd => rtd.d.IdTitle, t => t.IdTitle, (rtd, t) => new { rtd, t }) .Join(dbCustomer.GetCustomers(), rtdt => rtdt.rtd.rt.IdCustomer, c => c.IdCustomer, (rtdt, c) => new { rtdt, c }); foreach (var item in db) { lst.Add(new DiskInfoReturn { Address = item.c.Address, CustomerName = item.c.CustomerName, ExpectedDate = (DateTime)item.rtdt.rtd.rt.ExpectedReturnDate, IdCustomer = (int)item.rtdt.rtd.rt.IdCustomer, IdDisk = (int)item.rtdt.rtd.rt.IdDisk, PhoneNumber = item.c.PhoneNumber, RentedDate = (DateTime)item.rtdt.rtd.rt.RentalDate, Title = item.rtdt.t.NameTitle,IdListRented=item.rtdt.rtd.rt.IdListRented }); } return lst; }
private void btn_TimKiemKhachHang_Click(object sender, EventArgs e) { try { if (txt_MaKHNhapVao.CheckMa() == false) { return; } int customerId = Int32.Parse(txt_MaKHNhapVao.Text.ToString()); Customer customer = dbCus.GetCustomer(customerId); if (customer == null) { MessageBox.Show("Không tìm thấy khách hàng", "Thông tin khách hàng", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { LoadDataCustomerToText(customer); AddInfoListView(); } var lstLate = new ListRentedBUL().ListLate(customer.IdCustomer); if (lstLate.Count > 0) { DialogResult result = MessageBox.Show("Khách hàng có khoản trễ hạn. Có muốn thực hiện thanh toán không?", "Phí trễ hạn", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { FormThanhToan frm = new FormThanhToan(customer, lstLate, this.auth); frm.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Frm_FormClosing(object sender, FormClosingEventArgs e) { db = ExpressionMethod.DBDiskReturn(); dbListRented = new ListRentedBUL(); }