Beispiel #1
0
        public ActionResult Search(ProductMasterManagementViewModel model, GridSettings gridSettings)
        {
            if (string.IsNullOrEmpty(gridSettings.SortField))
            {
                gridSettings.SortField = "F85_Code";
                gridSettings.SortOrder = SortOrder.Asc;
            }
            var result = _productMasterManagementDomain.SearchCriteria(model.Location, gridSettings);

            if (!result.IsSuccess)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            return(Json(result.Data, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        //
        // GET: /EnvironmentManagement/ProductMasterManagement/
        public ActionResult Index()
        {
            ViewBag.ListLocation = _environmentBaseDomain.GetLocationItemByType("1").Select(x => new SelectListItem
            {
                Text  = x.F80_Name,
                Value = x.F80_Id.ToString()
            });

            ViewBag.ListProductName = _productMasterManagementDomain.GetProducts().Select(x => new SelectListItem
            {
                Text  = x.F09_ProductDesp,
                Value = x.F09_ProductCode
            });
            var model = new ProductMasterManagementViewModel();

            model.Grid = GenerateGrid();
            return(View(model));
        }
Beispiel #3
0
        public ActionResult AddOrUpdate(ProductMasterManagementViewModel model)
        {
            if (model.isCreate)
            {
                try
                {
                    //var checkLocation = _productMasterManagementDomain.CheckLocation(Int32.Parse(model.Location));
                    //if(!checkLocation)
                    //    return Json(new{Success=false,Message=EnvironmentResource.MSG8});

                    //var isChecked = _productMasterManagementDomain.CheckValueEntered(Int32.Parse(model.Location));
                    //if (!isChecked)
                    //    return Json(new { Success = false, Message = EnvironmentResource.MSG17 });

                    var item = Mapper.Map <ProductMasterManagementItem>(model);
                    _productMasterManagementDomain.Add(item);
                    return(Json(new { Success = true, Message = EnvironmentResource.MSG11 }));
                }
                catch (Exception e)
                {
                    return(Json(new { Success = false, Message = e.Message }));
                }
            }
            else
            {
                try
                {
                    var item = Mapper.Map <ProductMasterManagementItem>(model);
                    _productMasterManagementDomain.Edit(item);
                    return(Json(new { Success = true, Message = EnvironmentResource.MSG9 }));
                }
                catch (Exception e)
                {
                    return(Json(new { Success = false, Message = e.Message }));
                }
            }
        }