protected override void ControlsToData() { if (_bus == null) { _bus = new VME(); } base.ControlsToData(); }
public static List <VME> GetList_Products(DateTime date, string Ref) { erp_dataEntities2 db = new erp_dataEntities2(); List <Invoice> liste = db.Invoices./*Where(x => x.CreationDate >= DateTime.Now.AddDays(-10)).*/ ToList(); var AA = (from n in db.Invoices join c in db.InvoiceItems on n.Id equals c.IdInvoice where c.Code == Ref select new { code = c.Code, CreationDate = n.CreationDate, quantity = c.quantity }).Take(10).ToList(); List <VME> list = new List <VME>(); List <string> ss = new List <string>(); for (int i = 0; i < AA.Count - 1; i++) { int sum = 0; for (int j = i; j < AA.Count; j++) { if (AA[i].CreationDate.ToShortDateString() == AA[j].CreationDate.ToShortDateString()) { sum += AA[i].quantity; } if (!ss.Contains(AA[i].CreationDate.ToShortDateString())) { ss.Add(AA[i].CreationDate.ToShortDateString()); VME vme = new VME() { code = AA[i].code, date = AA[i].CreationDate, quantity = sum }; list.Add(vme); } } } return(list); }