Esempio n. 1
0
 public List <LichSuGD> getVanTinLichSuKH(DateTime dt1, DateTime dt2, string KH)
 {
     try
     {
         LichSuGD        lsgd     = new LichSuGD();
         List <LichSuGD> listLSGD = new List <LichSuGD>();
         var             dh       = (from a in data.Payments join b in data.DonHangs on a.MaDH equals b.MaDH where b.MaKH == KH select new { a, b });
         if (dh.Count() != 0)
         {
             var filter = dh.Where(a => a.a.Ngay > dt1 && a.a.Ngay < dt2);
             foreach (var i in filter)
             {
                 lsgd.MGD    = i.a.MaGD;
                 lsgd.ngay   = i.a.Ngay;
                 lsgd.phi    = i.a.Phi;
                 lsgd.sotien = i.b.SoTien;
                 listLSGD.Add(lsgd);
             }
             return(listLSGD);
         }
         else
         {
             return(null);
         }
     }
     catch { return(null); }
 }
Esempio n. 2
0
 public LichSuGD getLichSuGd(int MGD)
 {
     try
     {
         LichSuGD lsgd = new LichSuGD();
         if (data.Payments.Where(a => a.MaGD == MGD).Count() != 0)
         {
             DateTime date = new DateTime();
             Payment  pm   = data.Payments.Where(a => a.MaGD == MGD).Single();
             DonHang  dh   = data.DonHangs.Where(a => a.MaDH == pm.MaDH).Single();
             lsgd.MGD    = MGD;
             lsgd.ngay   = date;
             lsgd.phi    = pm.Phi;
             lsgd.sotien = dh.SoTien;
             return(lsgd);
         }
         else
         {
             return(null);
         }
     }
     catch { return(null); }
 }