/// <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;
 }
Example #2
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 LoadView()
 {
     binding.DataSource = db.GetDiskTypes();
     ExpressionMethod.LoadGridControl(grd_LoaiDia, grv_LoaiDia, binding);
 }