Exemple #1
0
        public JsonResult LoadUserGroups(int isActive)
        {
            //isActive=>Denotes which type of data to get(i.e,active,inactive or all)
            try
            {
                _UserDetailsBusinessLogic = new UserDetailsBusinessLogic();
                HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
                string     userType   = "N/A";

                if (authCookie != null)
                {
                    FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
                    userType = _UserDetailsBusinessLogic.GetUserType(ticket.Name).ToLower().Trim();

                    if (userType == "administrator")
                    {
                        var resultArr = _UserDetailsBusinessLogic.GetAllUserGroups(isActive);
                        return(Json(resultArr));
                    }
                    else
                    {
                        var resultArr = _UserDetailsBusinessLogic.GetAllUserGroupsForOtherUser(isActive);
                        return(Json(resultArr));
                    }
                }
                else
                {
                    var resultArr = _UserDetailsBusinessLogic.GetAllUserGroupsForOtherUser(isActive);
                    return(Json(resultArr));
                }
            }
            catch (Exception ex)
            {
                currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                methodName = sf.GetMethod().Name;
                ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, "UName", ex);
                return(Json(null));
            }
        }