public JsonResult GetHardwareInfo(DataSourceRequest command, HardwareListModel model) { if (model.Hardware_ID!=0) { model.Amount = _hardwareService.GetHardwareTypeById(model.Hardware_ID).HardwarePrice; model.HardwareTypeDescription = _hardwareService.GetHardwareTypeById(model.Hardware_ID).Description; } return Json(model); }
public ActionResult Hardware_req() { HttpSessionStateBase session = HttpContext.Session; HardwareListModel model = new HardwareListModel(); model.Hardware = GetHardwareTypes(); if(session["Customer_ID"] != null) { model.CustomerName = _customerService.GetCustomerById(Convert.ToInt32(session["Customer_ID"])).CustomerName; session.Remove("Customer_ID"); } return View(model); }
//[CheckSession] public virtual ActionResult CustomerSearch(DataSourceRequest command, HardwareListModel model) { //var UserItems = _groupService.SearchCustomer(model.GroupName, model.Description); var CustomerItems = _hardwareService.SearchCustomers(model.CustomerNameInSearch, model.MobileNo, model.SubscriptionCode, model.TelNo); var ProductItems = _productService.GetAllProducts(); var CustomerProductItems = _productService.GetAllCustomerProducts(); var query1 = from cus in CustomerItems join cusprod in CustomerProductItems on cus.Customer_ID equals cusprod.Customer_ID select new { cus.Customer_ID, cus.CustomerName, cus.SubscriptionCode, cus.TelNo, cus.MobileNo, cusprod.Products_ID }; var query2 = from qu1 in query1 join prod in ProductItems on qu1.Products_ID equals prod.Products_ID select new { qu1.Customer_ID, qu1.CustomerName, qu1.SubscriptionCode, qu1.TelNo, qu1.MobileNo, prod.ProductsName }; var gridModel = new DataSourceResult { Data = query2.Select(x => new HardwareModel { TelNo = x.TelNo, SubscriptionCode = x.SubscriptionCode, MobileNo = x.MobileNo, Customer_ID = x.Customer_ID, ProductsName = x.ProductsName, CustomerNameInSearch = x.CustomerName }), Total = query2.Count() }; return Json(gridModel); }
public ActionResult SubmitHardware(DataSourceRequest command, HardwareListModel model) { HttpSessionStateBase session = HttpContext.Session; try { if (false) // field validation { var gridModel = new DataSourceResult { ExtraData = new HardwareListModel { Message = Message.InvalidCharacter, }, Total = 1 }; return Json(gridModel); } Tbl_Hardware tu = new Tbl_Hardware(); tu.Request_ID = model.Request_ID; tu.CustomerConnector = model.CustomerConnector; tu.Customer_ID = model.Customer_ID; tu.Description = model.Description; tu.Hardware_ID = model.Hardware_ID; tu.RequestDate = model.RequestDate; if (model.Check_Delivery && !model.Check_Revocation) tu.Status = 1; else if (!model.Check_Delivery && model.Check_Revocation) tu.Status = 2; else tu.Status = 0; tu.DeliveryDate = model.DeliveryDate; tu.DeliveryDescription = model.DeliveryDescription; tu.DeliveryDeviceSerialNumber = model.DeliveryDeviceSerialNumber; tu.Amount = model.Amount; tu.LastUpdateUser_ID = Convert.ToInt32(session["UserID"]); tu.LastUpdateDate = DateTime.Now.ToString("yyyy-MM-dd"); tu.LastUpdateTime = DateTime.Now.ToString("HH:mm"); if (_hardwareService.AddNewHardware(tu)) { var gridModel = new DataSourceResult { ExtraData = new HardwareListModel { Message = Message.OperationSuccessful, MessageColor = "green" }, Total = 1 }; return Json(gridModel); } else { var gridModel = new DataSourceResult { ExtraData = new HardwareListModel { Message = Message.OperationUnsuccessful, MessageColor = "red" }, Total = 1 }; return Json(gridModel); } } catch (Exception ex) { var gridModel = new DataSourceResult { ExtraData = new HardwareListModel { Message = Message.OperationUnsuccessful, MessageColor = "red" }, Total = 1 }; return Json(gridModel); } //return ""; }
public virtual ActionResult HardwareList(DataSourceRequest command, HardwareListModel model) { if (string.IsNullOrEmpty(model.CustomerConnector) && model.Hardware_ID == 0 && model.Amount == 0 && string.IsNullOrEmpty(model.RequestDate) && string.IsNullOrEmpty(model.Description) && model.Status == 0 ) { var hardwareItems = _hardwareService.GetAllHardware(); var gridModel = new DataSourceResult { Data = hardwareItems.Select(x => new HardwareModel { Amount = x.Amount, CustomerName = _customerService.GetCustomerById(x.Customer_ID).CustomerName, Hardware = _hardwareService.GetHardwareById(x.Hardware_ID).HardwareName, CustomerConnector = x.CustomerConnector, RequestDate = x.RequestDate, Description = x.Description, HardwareTypeDescription = _hardwareService.GetHardwareTypeById(x.Hardware_ID).Description, DeliveryDate = x.DeliveryDate, DeliveryDescription = x.DeliveryDescription, DeliveryDeviceSerialNumber = x.DeliveryDeviceSerialNumber, Check_Delivery = x.Status == 1 ? true : false, Check_Revocation = x.Status == 2 ? true : false, Customer_ID = x.Customer_ID, Hardware_ID = x.Hardware_ID, Request_ID = x.Request_ID }), Total = hardwareItems.Count() }; return Json(gridModel); } else { var hardwareItems = _hardwareService.SearchHardware(model.CustomerConnector,model.Hardware_ID,model.RequestDate,model.Description,model.Status); var gridModel = new DataSourceResult { Data = hardwareItems.Select(x => new HardwareModel { Amount = x.Amount, CustomerName = _customerService.GetCustomerById(x.Customer_ID).CustomerName, Hardware = _hardwareService.GetHardwareById(x.Hardware_ID).HardwareName, CustomerConnector = x.CustomerConnector, RequestDate = x.RequestDate, Description = x.Description, Customer_ID = x.Customer_ID, Hardware_ID = x.Hardware_ID, Request_ID = x.Request_ID, HardwareTypeDescription = _hardwareService.GetHardwareTypeById(x.Hardware_ID).Description, DeliveryDate = x.DeliveryDate, DeliveryDescription = x.DeliveryDescription, DeliveryDeviceSerialNumber = x.DeliveryDeviceSerialNumber, Check_Delivery = x.Status == 1 ? true : false, Check_Revocation = x.Status == 2 ? true : false, }), Total = hardwareItems.Count() }; return Json(gridModel); } }