public ActionResult SubCategoryView(string prm = "")
        {
            HomeCategoryViewModel objHomeCategoryViewModel = new HomeCategoryViewModel();

            //if prm(Paramter) is empty means Add condition else edit condition
            if (!String.IsNullOrEmpty(prm))
            {
                int SubCategoryId;
                //decrypt parameter and set in CategoryId variable
                int.TryParse(CommonUtils.Decrypt(prm), out SubCategoryId);
                //Get Category detail by  Category Id
                serviceResponse          = objUtilityWeb.GetAsync(WebApiURL.Home + "/GetSubCategoryList?SubCategoryId=" + SubCategoryId.ToString());
                objHomeCategoryViewModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <HomeCategoryViewModel>().Result : null;
                objHomeCategoryViewModel.SelectedSubCatId = SubCategoryId;
            }

            return(View(objHomeCategoryViewModel));
        }
        public ActionResult ActivateDeactivateSubCategory(string prm = "")
        {
            CategoryModel objCategoryModel = new CategoryModel();

            try
            {
                //if prm(Paramter) is empty means Add condition else edit condition
                if (!String.IsNullOrEmpty(prm))
                {
                    int SubCategoryId;
                    int Status;
                    //decrypt parameter and set in CategoryId variable
                    int.TryParse(CommonUtils.Decrypt(prm.Split('~')[0]), out SubCategoryId);
                    int.TryParse(prm.Split('~')[1], out Status);
                    //Get Category detail by  Category Id


                    serviceResponse  = objUtilityWeb.GetAsync(WebApiURL.SubCategory + "/UpdateSubCategoryStatusByID?SubCategoryId=" + SubCategoryId.ToString() + "&status=" + Status);
                    objCategoryModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <CategoryModel>().Result : null;

                    //serviceResponse = objUtilityWeb.GetAsync(WebApiURL.UserLogin + "/GetUserListById?UserId=" + UserId.ToString());
                    //objUserLogin = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync<UserLogin>().Result : null;
                    //if (objUserLogin != null)
                    //{

                    //    serviceResponse = objUtilityWeb.GetAsync(WebApiURL.UserLogin + "/UpdateUserStatusByID?UserId=" + CategoryId.ToString() + "&status=" + Status);
                    //    objUserLogin = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync<UserLogin>().Result : null;


                    //    //Admin_UpdateUserStatusByID

                    //}
                }
            }
            catch (Exception ex)
            {
                ErrorLog(ex, "ViewSubCategory", "ViewSubCategory");
            }

            return(RedirectToAction("ViewSubCategory"));
        }
        public ActionResult SaveSubCategory(string prm = "")
        {
            SubCategoryModel objSubCategoryModel = new SubCategoryModel();

            try
            {
                //if prm(Paramter) is empty means Add condition else edit condition
                if (!String.IsNullOrEmpty(prm))
                {
                    int SubCategoryId;
                    //decrypt parameter and set in SubCategoryId variable
                    int.TryParse(CommonUtils.Decrypt(prm), out SubCategoryId);
                    //Get SubCategory detail by  SubCategory Id
                    serviceResponse     = objUtilityWeb.GetAsync(WebApiURL.SubCategory + "/GetSubCategoryById?SubCategoryId=" + SubCategoryId.ToString());
                    objSubCategoryModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <SubCategoryModel>().Result : null;
                }
                CaegoryDropDown(objSubCategoryModel.CategoryID);
            }
            catch (Exception ex)
            {
                ErrorLog(ex, "SubCategory", "SaveSubCategory Get");
            }

            return(View("SaveSubCategory", objSubCategoryModel));
        }
Exemplo n.º 4
0
        private Logic GenerateTileLogic(AppTile appTile)
        {
            if (appTile.logicType == LogicType.AllReports)
            {
                return(GetTeamSite_AllReportsTile().BasicLogic);
            }
            else
            {
                List <TileQueryLogic> tileLogicList = _tileQueryLogicRepository.GetTileQueryLogicsByTileId(appTile.Id.Value);

                #region Generate the Logic

                #region Set up the dictionary of type

                var tagId         = new TagId();
                var reportOwnerId = new ReportOwnerId();
                var subCategoryId = new SubCategoryId();
                var reportDataId  = new ReportDataId();

                Dictionary <string, IIN <Int32> > dc = new Dictionary <string, IIN <int> >();
                dc.Add(tagId.Name, tagId);
                //dc.Add(reportOwnerId.Name, reportOwnerId);
                dc.Add(subCategoryId.Name, subCategoryId);
                dc.Add(reportDataId.Name, reportDataId);


                Dictionary <string, IIN <String> > dcString = new Dictionary <string, IIN <string> >();
                dcString.Add(reportOwnerId.Name, reportOwnerId);


                #endregion

                Logic resultLogic = null;

                if (appTile.logicType == LogicType.Selected)
                {
                    resultLogic = dc[reportDataId.Name].In(tileLogicList[0].FiledValue.Split(',').Select(_ => int.Parse(_)));
                }

                if (appTile.logicType == LogicType.Filtered)
                {
                    var logic = new AND();
                    foreach (var item in tileLogicList)
                    {
                        Logic l = null;


                        if (item.FiledValue.GetType() == typeof(string) && dcString.Keys.Contains <string>(item.FiledName))
                        {
                            l = dcString[item.FiledName].In(item.FiledValue.Split(',').Select(_ => _.ToString()));
                        }
                        else
                        {
                            l = dc[item.FiledName].In(item.FiledValue.Split(',').Select(_ => int.Parse(_)));
                        }
                        logic.AddElement(l);
                    }
                    resultLogic = logic;
                }

                if (appTile.logicType == LogicType.Tagged)
                {
                    Logic logic = dc[tagId.Name].In(tileLogicList[0].FiledValue.Split(',').Select(_ => int.Parse(_)));
                    resultLogic = logic;
                }

                #endregion

                return(resultLogic);
            }
        }