public FormThueDia(string auth) { InitializeComponent(); dbCus = new CustomerBUL(); dbRented = new ListRentedBUL(); db = ExpressionMethod.DBDiskRent(); this.binding = new BindingSource(); this.auth = auth; }
private void ThucHienThueDia() { if (txtMaKH.CheckMa() == false) { return; } ThucHienLayDiaDatTruoc(); int idCustomer = Int32.Parse(txtMaKH.Text.ToString()); foreach (var item in binding.DataSource as List <DiskInfoRent> ) { ListRented rented = new ListRented { IdDisk = item.IdDisk, IdCustomer = idCustomer, LateFee = item.LateFee, RentalDate = DateTime.Today, ExpectedReturnDate = DateTime.Today.AddDays(item.TimeRented), ActualReturnDate = null, StatusOnBill = null }; if (dbRented.AddListRented(rented) == false) { MessageBox.Show("Thuê đĩa thất bại", "Thuê đĩa", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } MessageBox.Show("Thuê đĩa thành công", "Thuê đĩa", MessageBoxButtons.OK, MessageBoxIcon.Error); db = ExpressionMethod.DBDiskRent(); binding.DataSource = new List <DiskInfoRent>(); }