public JsonResult Delete(int Id)
        {
            var UserCategoryEntity = _UserCategoryService.GetById(Id);

            if (UserCategoryEntity != null)
            {
                if (UserCategoryEntity.IsSystemAdmin == true)
                {
                    return(Json(new { data = Id, success = false, ErrorsList = Resources.LocalizedText.UserCategory_Validation_IsSystemAdmin }, JsonRequestBehavior.AllowGet));
                }
                _UserCategoryService.Delete(UserCategoryEntity);
                return(Json(new { data = Id, success = true }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { data = Id, success = false, ErrorsList = Resources.LocalizedText.DeletedItemNotFound }, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult ViewCategoryAndItem(decimal ItemId, decimal CategoryId)
        {
            var model = new ViewCategoryAndItemViewModel();

            model.CategoryName = _userCategoryService.GetById(CategoryId).Name;
            model.ItemName     = _itemService.GetById(ItemId).Name;
            return(PartialView(model));
        }
Beispiel #3
0
        public ActionResult Index(decimal?SearchSelectedCategoryId)
        {
            ViewBag.Title   = Resources.PageTitle.Item_Index;
            ViewBag.PageBar = GetPageBar(Resources.PageTitle.Item_Index);

            var SearchSelected = new BaseCategoryViewModel();

            SearchSelected.Level1Id       = CurrentUser.Level1Id;
            SearchSelected.Level2Id       = CurrentUser.Level2Id;
            SearchSelected.Level3Id       = CurrentUser.Level3Id;
            SearchSelected.Level4Id       = CurrentUser.Level4Id;
            SearchSelected.UserCategoryId = CurrentUser.UserCategoryId;
            if (SearchSelectedCategoryId.HasValue)
            {
                var category = _userCategoryService.GetById(SearchSelectedCategoryId);
                SearchSelected.Level1Id       = category.Level1Id;
                SearchSelected.Level2Id       = category.Level2Id;
                SearchSelected.Level3Id       = category.Level3Id;
                SearchSelected.Level4Id       = category.Level4Id;
                SearchSelected.UserCategoryId = category.Id;
            }
            ViewBag.SearchSelected = SearchSelected;
            return(View());
        }
        public ActionResult ItemTable()
        {
            decimal?SearchUserCategory = Request.QueryString["UserCategoryId"].ToNullableDecimal();
            decimal?SearchJobTitle     = Request.QueryString["JobTitleId"].ToNullableDecimal();
            decimal?SearchUser         = Request.QueryString["UserId"].ToNullableDecimal();

            if (!SearchUserCategory.HasValue)
            {
                return(PartialView());
            }

            var data        = _sectorService.SectorsItems(SearchUserCategory.Value);
            var uerCategory = Mapper.Map <UserCategoryViewModel>(_userCategoryService.GetById(SearchUserCategory));

            ViewBag.UerCategory = uerCategory;
            return(PartialView(data));
        }