public ActionResult GetDeviceInfo2(DataSourceRequest command, SendToRepairListModel model) { var HardwareItems = _hardwareService.GetAllHardware(); var HardwareTypeItems = _hardwareService.GetAllHardwareTypes(); var query1 = from hi in HardwareItems join hti in HardwareTypeItems on hi.Hardware_ID equals hti.Hardware_ID where hi.Request_ID == model.DeviceSerialNumber_ID && hi.DeliveryDate != null select new { hi.DeliveryDate, hti.WarrantyPeriod }; var gridModel = new DataSourceResult { ExtraData = new SendToRepairModel { DeliveryDate = query1.FirstOrDefault().DeliveryDate, WarrantyPeriod = query1.FirstOrDefault().WarrantyPeriod }, Total = query1.Count() }; return Json(gridModel); }
public virtual ActionResult SendToRepairList(DataSourceRequest command, SendToRepairListModel model) { if (model.Customer_ID == 0 && string.IsNullOrEmpty(model.CustomerConnector) && string.IsNullOrEmpty(model.PostageDate) && string.IsNullOrEmpty(model.ReturnDate) && string.IsNullOrEmpty(model.ProblemInfo) && string.IsNullOrEmpty(model.Reserve) && string.IsNullOrEmpty(model.Description)) { var hardwareItems = _hardwareService.GetAllSendToRepair(); var gridModel = new DataSourceResult { Data = hardwareItems.Select(x => new SendToRepairModel { CustomerName = _customerService.GetCustomerById(x.Customer_ID).CustomerName, CustomerConnector = x.CustomerConnector, DeviceSerialNumber = x.DeviceSerialNumber, DeliveryDate = x.DeliveryDate, WarrantyPeriod = x.WarrantyPeriod, Description = x.Description, Customer_ID = x.Customer_ID, Request_ID = x.Request_ID, ProblemInfo = x.ProblemInfo, PostageDate = x.PostageDate, ReturnDate = x.ReturnDate }), Total = hardwareItems.Count() }; return Json(gridModel); } else { var hardwareItems = _hardwareService.SearchSendToRepair(model.CustomerConnector, model.ProblemInfo, model.PostageDate, model.ReturnDate, model.Reserve, model.Description); var gridModel = new DataSourceResult { Data = hardwareItems.Select(x => new SendToRepairModel { CustomerName = _customerService.GetCustomerById(x.Customer_ID).CustomerName, CustomerConnector = x.CustomerConnector, DeviceSerialNumber = x.DeviceSerialNumber, DeliveryDate = x.DeliveryDate, WarrantyPeriod = x.WarrantyPeriod, Description = x.Description, Customer_ID = x.Customer_ID, Request_ID = x.Request_ID, ProblemInfo = x.ProblemInfo, PostageDate = x.PostageDate, ReturnDate = x.ReturnDate }), Total = hardwareItems.Count() }; return Json(gridModel); } }
public ActionResult SendToRepair() { HttpSessionStateBase session = HttpContext.Session; SendToRepairListModel model = new SendToRepairListModel(); //model.Product = GetProductDropDown(); //model.TroubleShooting = _tsh.GetTroubleShootingList(); //if (session["Customer_ID"] != null) //{ // model.CustomerName = _customerService.GetCustomerById(Convert.ToInt32(session["Customer_ID"])).CustomerName; // session.Remove("Customer_ID"); //} model.DeviceSerialNumber = new List<SelectListItem>(); return View(model); }