public ActionResult SubmitSoftwareType(SoftwareTypeListModel model) { HttpSessionStateBase session = HttpContext.Session; try { Tbl_SoftwareType tu = new Tbl_SoftwareType(); tu.Description = model.Description; tu.SoftwareName = model.SoftwareName; tu.SoftwarePrice = model.SoftwarePrice; tu.Software_ID = model.Software_ID; tu.Products_ID = model.Products_ID; tu.LastUpdateUser_ID = Convert.ToInt32(session["UserID"]); tu.LastUpdateDate = DateTime.Now.ToString("yyyy-MM-dd"); tu.LastUpdateTime = DateTime.Now.ToString("HH:mm"); if (_softwareService.AddNewSoftwareType(tu)) { var gridModel = new DataSourceResult { ExtraData = new SoftwareTypeListModel { Message = Message.OperationSuccessful, MessageColor = "green" }, Total = 1 }; return(Json(gridModel)); } else { var gridModel = new DataSourceResult { ExtraData = new SoftwareTypeListModel { Message = Message.OperationUnsuccessful, MessageColor = "red" }, Total = 1 }; return(Json(gridModel)); } } catch (Exception ex) { var gridModel = new DataSourceResult { ExtraData = new SoftwareTypeListModel { Message = Message.OperationUnsuccessful, MessageColor = "red" }, Total = 1 }; return(Json(gridModel)); } //return ""; }
public ActionResult SoftwareType() { HttpSessionStateBase session = HttpContext.Session; SoftwareTypeListModel model = new SoftwareTypeListModel(); 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"); //} return(View(model)); }
public virtual ActionResult SoftwareTypeList(DataSourceRequest command, SoftwareTypeListModel model) { if (model.Software_ID == 0 && string.IsNullOrEmpty(model.Description) && string.IsNullOrEmpty(model.SoftwareName) && model.SoftwarePrice == 0 && model.Products_ID == 0) { var hardwareItems = _softwareService.GetAllSoftwareTypes(); var gridModel = new DataSourceResult { Data = hardwareItems.Select(x => new SoftwareTypeModel { Product = _productService.GetProductById(x.Products_ID).ProductsName, SoftwareName = x.SoftwareName, SoftwarePrice = x.SoftwarePrice, Software_ID = x.Software_ID, Products_ID = x.Products_ID, Description = x.Description, }), Total = hardwareItems.Count() }; return(Json(gridModel)); } else { var hardwareItems = _softwareService.SearchSoftwareType(model.Description, model.SoftwareName, model.SoftwarePrice, model.Products_ID); var gridModel = new DataSourceResult { Data = hardwareItems.Select(x => new SoftwareTypeModel { Product = _productService.GetProductById(x.Products_ID).ProductsName, SoftwareName = x.SoftwareName, SoftwarePrice = x.SoftwarePrice, Software_ID = x.Software_ID, Products_ID = x.Products_ID, Description = x.Description, }), Total = hardwareItems.Count() }; return(Json(gridModel)); } }