public JsonResult DataRequested() { string DateString = Session["date"].ToString(); int Month = Convert.ToInt32(DateString.Substring(0, 2)); int Year = Convert.ToInt32(DateString.Substring(2, 4)); //string Parsed = DateString.Substring(0, 2) + "/" + DateString.Substring(2, 4); //DateTime date = Convert.ToDateTime(DateString); var gridModel = new LeasingDatabase.Models.Grid.EOLJqGridModel(); var db = new AuleaseEntities(); SetUpGrid(gridModel.OrdersGrid); var EOL = db.Components.Where(n => n.ReturnDate.Value.Month == Month && n.ReturnDate.Value.Year == Year); var model = EOL.Select(n => new EOLModel { Id = n.Id, SN = n.SerialNumber.Substring(n.SerialNumber.Length - 7, n.SerialNumber.Length), SerialNumber = n.SerialNumber, ComponentType = n.Type.Name, Make = n.Make.Name, Model = n.Model.Name ?? null, StatementName = n.Leases.OrderByDescending(o => o.Timestamp).FirstOrDefault().StatementName, GID = n.Leases.OrderByDescending(o => o.Timestamp).FirstOrDefault().SystemGroup.User.GID, EndBillingDate = n.Leases.OrderByDescending(o => o.EndDate).FirstOrDefault().EndDate, ReturnDate = n.ReturnDate, Damages = n.Damages }); return(gridModel.OrdersGrid.DataBind(model)); }
public ActionResult Report(string date) { Session["date"] = date; var gridModel = new LeasingDatabase.Models.Grid.EOLJqGridModel(); var ordersGrid = gridModel.OrdersGrid; SetUpGrid(ordersGrid); return(View(gridModel)); }