/// <summary>
 /// Join and return a db DiskRent
 /// </summary>
 /// <returns></returns>
 public static List<DiskInfoRent> DBDiskRent()
 {
     DiskTypeBUL dbDiskType= new DiskTypeBUL();
     TitleBUL dbTitle = new TitleBUL();
     DiskBUL dbDisk = new DiskBUL();
     List<DiskInfoRent> lst = new List<DiskInfoRent>();
     List<Disk> disks = dbDisk.GetDisks();
     List<DiskType> diskTypes = dbDiskType.GetDiskTypes();
     List<Title> titles = dbTitle.GetTitles();
     var db = dbDisk.GetDisks()
         .Join(dbTitle.GetTitles(), d => d.IdTitle, t => t.IdTitle, (d, t) => new { d, t })
         .Join(dbDiskType.GetDiskTypes(), dt => dt.t.IdDiskType, ty => ty.IdDiskType, (dt, ty) => new { dt, ty })
         .Select(x => new
         {
             IdDisk = x.dt.d.IdDisk,
             Title = x.dt.t.NameTitle,
             TypeName = x.ty.TypeName,
             TimeRented = x.ty.TimeRented,
             LateFee = x.ty.LateFee,
             Price = x.ty.Price,
             DiskRentalStatus = x.dt.d.DiskRentalStatus
         }).ToList();
     foreach (var item in db)
         lst.Add(new DiskInfoRent { IdDisk = item.IdDisk, LateFee = (int)item.LateFee, Price = (int)item.Price, TimeRented = (int)item.TimeRented, Title = item.Title, TypeName = item.TypeName, DiskRentalStatus = item.DiskRentalStatus });
     return lst;
 }
 public FormTieuDe(string auth)
 {
     InitializeComponent();
     this.auth = auth;
     db        = new TitleBUL();
     binding   = new BindingSource();
 }
 public FormBaoCao()
 {
     InitializeComponent();
     dbTitle         = new TitleBUL();
     dbRented        = new ListRentedBUL();
     dbCustomer      = new CustomerBUL();
     dbListPre       = new ListTitlePreOrderBUL();
     dbDisk          = new DiskBUL();
     bindingTitle    = new BindingSource();
     bindingCustomer = new BindingSource();
 }
 public FormDanhSachDatTruoc()
 {
     InitializeComponent();
     dbDetailPre            = new DetailPreOrderBUL();
     dbListTitlePre         = new ListTitlePreOrderBUL();
     dbTitle                = new TitleBUL();
     dbDisk                 = new DiskBUL();
     dbCus                  = new CustomerBUL();
     bindingChiTietDatTruoc = new BindingSource();
     bindingDSDatTruoc      = new BindingSource();
 }
 private void Frm_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         db = new TitleBUL();
         binding.DataSource = db.GetTitles();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #6
0
 public FormLienHeDatTruoc()
 {
     InitializeComponent();
     dbDetail          = new DetailPreOrderBUL();
     dbListPreOrder    = new ListTitlePreOrderBUL();
     dbListPreOrder    = new ListTitlePreOrderBUL();
     dbTitle           = new TitleBUL();
     dbDisk            = new DiskBUL();
     dbDiskType        = new DiskTypeBUL();
     dbCustomer        = new CustomerBUL();
     bindingDSTilte    = new BindingSource();
     bindingDSDatTruoc = new BindingSource();
 }
예제 #7
0
        private void LoadNhungTieuDeDangChoAccept()
        {
            //Load những cái tiêu đề nào có đĩa đang chờ được accept
            var db = dbDetail.GetDetailPreOrders().Where(x => x.Accepted == false)
                     .Join(dbDisk.GetDisks(), dt => dt.IdDisk, d => d.IdDisk, (dt, d) => new { dt, d })
                     .Join(dbTitle.GetTitles(), dtd => dtd.d.IdTitle, t => t.IdTitle, (dtd, t) => new { dtd, t }).ToList();
            var lstTitle = dbTitle.GetTitles().Where(x => db.Find(k => k.t.IdTitle == x.IdTitle) != null).ToList()
                           .Join(dbDiskType.GetDiskTypes(), t => t.IdDiskType, dt => dt.IdDiskType, (t, dt) => new TitleOrder {
                IdTitle = t.IdTitle, NameTitle = t.NameTitle, TitleType = dt.TypeName
            });

            bindingDSTilte.DataSource = lstTitle;
            dbDetail = new DetailPreOrderBUL();
            dbDisk   = new DiskBUL();
            dbTitle  = new TitleBUL();
        }
        private void LoadDanhSachDatTruoc()
        {
            // Load những list nào đang imcomplete và những list nào complete nhưng id list vẫn còn ở dưới detail

            var data = dbListTitlePre.GetListTitlePreOrders().Where(x => x.StatusProcess.Equals(STATUS_INCOMPLETED) || dbDetailPre.GetDetailPreOrders().Find(d => d.IdListTitlePreOrder == x.IdListTitlePreOrder) != null)
                       .Join(dbTitle.GetTitles(), dt => dt.IdTitle, t => t.IdTitle, (dt, t) => new { dt, t })
                       .Join(dbCus.GetCustomers(), dtt => dtt.dt.IdCustomer, c => c.IdCustomer, (dtt, c) => new MyListTitlePreOrder {
                IdCustomer = c.IdCustomer, IdListPreOrder = dtt.dt.IdListTitlePreOrder, NameCustomer = c.CustomerName, NameTitle = dtt.t.NameTitle
            });

            bindingDSDatTruoc.DataSource = data;
            dbListTitlePre = new ListTitlePreOrderBUL();
            dbCus          = new CustomerBUL();
            dbTitle        = new TitleBUL();
            dbDetailPre    = new DetailPreOrderBUL();
        }
 /// <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;
 }
 public FormThemTD()
 {
     InitializeComponent();
     db = new TitleBUL();
 }