Example #1
0
        public ActionResult GetPowerList(Dictionary <string, string> queryvalues)
        {
            string seachtype = queryvalues.ContainsKey("seachtype") ? queryvalues["seachtype"] : "";
            string Value     = queryvalues.ContainsKey("Value") ? queryvalues["Value"] : "";

            ViewData["seachtype"] = seachtype;
            ViewData["Value"]     = Value;
            ResourceView           model   = new ResourceView();
            IEnumerable <Resource> resList = new List <Resource>();

            if (seachtype == "1")
            {//角色查询
                resList = SUBLL.GetResourceListByRoleName(Value.Trim());
            }
            else if (seachtype == "2")
            {//用户查询
                if (Value.Trim() == "admin")
                {
                    resList = SUBLL.GetAdminResourceList();
                }
                else
                {
                    resList = SUBLL.GetUserRoleResourceListByUserId(Value.Trim());
                }
            }
            else
            {
            }
            model.DataList = resList;
            model.UserID   = Value;
            return(View(model));
        }
Example #2
0
        public ActionResult SaveSysEmailUpdate(Dictionary <string, string> queryvalues)
        {
            string checkbox = queryvalues.ContainsKey("checkbox") ? queryvalues["checkbox"] : "";
            string numLimit = queryvalues.ContainsKey("faqtitle") ? queryvalues["faqtitle"] : "";
            string id       = queryvalues.ContainsKey("Id") ? queryvalues["Id"] : "";

            //   1,2,4,5
            //   1,2,,1,
            numLimit += ',';
            string[] checkboxS = checkbox.Split(',');
            string[] numLimits = numLimit.Split(',');
            string   saveStr   = "";

            if (checkbox != "")
            {
                for (int i = 0; i < checkboxS.Length; i++)
                {
                    saveStr += checkboxS[i] + ":" + numLimits[Convert.ToInt32(checkboxS[i]) - 1] + ",";
                }
            }

            saveStr = saveStr.Trim(',');

            bool res = SUBLL.AddUserLimit(id, saveStr, 1);



            return(Redirect("/SU/SetSysEmailLimit"));
        }
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            var controllerName = actionContext.ControllerContext.RouteData.Values["controller"].ToString();

            var method = (actionContext.ControllerContext.Request.Method).Method;
            var url    = controllerName + "/" + method;

            var userid   = HttpContext.Current.User.Identity.GetUserId();
            var userName = HttpContext.Current.User.Identity.Name.ToLower();

            if (userName != "admin")
            {//如果不是内置初始管理员,那么就走权限系统
             //不是登录登出,登录登出不走权限系统
                //检查用户是否有此action的权限,没有就跳转到提示无权限的页面
                bool check = SUBLL.CheckUserAction(userid, url);
                if (check == false)
                {
                    //跳转
                    HttpContext.Current.Response.Clear();



                    HttpContext.Current.Response.Write("2020");
                    HttpContext.Current.Response.End();
                }
            }

            base.OnActionExecuting(actionContext);
        }
Example #4
0
        public ActionResult SaveUserResource(Dictionary <string, string> queryvalues)
        {
            string userid = queryvalues.ContainsKey("userid") ? queryvalues["userid"] : "";
            string no     = queryvalues.ContainsKey("checkbox-inline") ? queryvalues["checkbox-inline"] : "";

            int res = SUBLL.AddUserResource(userid, no);

            return(Redirect("/SU/Management"));
        }
Example #5
0
        public ActionResult SaveRoleResource(Dictionary <string, string> queryvalues)
        {
            string roleid = queryvalues.ContainsKey("roleid") ? queryvalues["roleid"] : "";
            string no     = queryvalues.ContainsKey("checkbox-inline") ? queryvalues["checkbox-inline"] : "";

            int res = SUBLL.AddRoleResource(roleid, no);

            return(Redirect("/SU/Role"));
        }
Example #6
0
        public ActionResult SaveGlobalEmailLimit(Dictionary <string, string> queryvalues)
        {
            string gold  = queryvalues.ContainsKey("gold") ? queryvalues["gold"] : "";
            string wubi  = queryvalues.ContainsKey("wubi") ? queryvalues["wubi"] : "";
            string jifen = queryvalues.ContainsKey("jifen") ? queryvalues["jifen"] : "";
            //   1,2,4,5
            //   1,2,,1,
            string saveStr = "";

            try
            {
                if (!string.IsNullOrEmpty(gold))
                {
                    Convert.ToInt32(gold);
                    saveStr += (gold + ",");
                }
                else
                {
                    saveStr += (20000 + ",");
                }
                if (!string.IsNullOrEmpty(wubi))
                {
                    Convert.ToInt32(wubi);
                    saveStr += (wubi + ",");
                }
                else
                {
                    saveStr += (20 + ",");
                }
                if (!string.IsNullOrEmpty(jifen))
                {
                    Convert.ToInt32(jifen);
                    saveStr += (jifen + ",");
                }
                else
                {
                    saveStr += (20000 + ",");
                }
            }
            catch {
                return(Content("-1"));
            }

            saveStr = saveStr.Trim(',');

            bool res = SUBLL.AddUserLimit("0", saveStr, 3);

            if (res)
            {
                return(Content("1"));
            }
            else
            {
                return(Content("0"));
            }
        }
Example #7
0
        public ActionResult SetUserResource(string id)
        {
            ResourceView model = new ResourceView();

            IEnumerable <Resource> resList = SUBLL.GetResourceListByUserId(id);

            model.DataList = resList;
            model.UserID   = id;
            return(View(model));
        }
Example #8
0
        public ActionResult Management(Dictionary <string, string> queryvalues)
        {
            int page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 1;

            if (Request.IsAjaxRequest())
            {
                return(PartialView("Management_PageList", SUBLL.GetListByPage(page)));
            }
            PagedList <ApplicationUser> model = SUBLL.GetListByPage(page);

            return(View(model));
        }
Example #9
0
        public ActionResult OperLog(Dictionary <string, string> queryvalues)
        {
            int    _page           = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 1;
            string _StartDate      = queryvalues.ContainsKey("StartDate") ? queryvalues["StartDate"] : DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
            string _ExpirationDate = queryvalues.ContainsKey("ExpirationDate") ? queryvalues["ExpirationDate"] : DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00");

            string _UserAccount = queryvalues.ContainsKey("UserAccount") ? queryvalues["UserAccount"] : "";



            BaseDataView vbd = new BaseDataView {
                SearchExt = _UserAccount, Page = _page, StartDate = _StartDate, ExpirationDate = _ExpirationDate
            };


            IEnumerable <AspNetUser> users  = SUBLL.GetAspNetUsers();
            List <SelectListItem>    ieList = new List <SelectListItem>();

            ieList.Insert(0, new SelectListItem {
                Text = "所有账号", Value = "", Selected = "" == _UserAccount
            });
            int i = 1;

            foreach (var item in users)
            {
                if (string.IsNullOrEmpty(item.NickName))
                {
                    ieList.Insert(i++, new SelectListItem {
                        Text = item.UserName, Value = item.UserName, Selected = item.UserName == _UserAccount
                    });
                }
                else
                {
                    ieList.Insert(i++, new SelectListItem {
                        Text = item.UserName + "(" + item.NickName + ")", Value = item.UserName, Selected = item.UserName == _UserAccount
                    });
                }
            }


            ViewData["UserAccount"] = ieList;

            //通过时间查询role列表



            vbd.BaseDataList = SUBLL.GetLogListByPage(vbd);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("OperLog_PageList", vbd.BaseDataList));
            }
            return(View(vbd));
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var controllerName = filterContext.RouteData.Values["controller"].ToString();
            var actionName     = filterContext.RouteData.Values["action"].ToString();
            var url            = controllerName + "/" + actionName;


            var userid   = HttpContext.Current.User.Identity.GetUserId();
            var userName = HttpContext.Current.User.Identity.Name.ToLower();

            if (url == "Home/Login" || url == "Home/login")
            {
                if (!string.IsNullOrEmpty(userName))
                {
                    HttpContext.Current.Response.Redirect("/Base/Default");
                }
            }


            if (userName != "admin")  //如果不是内置初始管理员,那么就走权限系统
            {
                if (
                    url.ToLower() != "home/login" &&
                    url.ToLower() != "home/logoff" &&
                    controllerName.ToLower() != "error" &&
                    url.ToLower() != "base/default" &&
                    controllerName.ToLower() != "noauth" &&
                    controllerName.ToUpper() != "AD" &&
                    controllerName.ToLower() != "simulatorrecharge"
                    )   //不是登录登出,登录登出不走权限系统
                //检查用户是否有此action的权限,没有就跳转到提示无权限的页面
                {
                    bool check = SUBLL.CheckUserAction(userid, url);
                    if (check == false)
                    {
                        //跳转
                        HttpContext.Current.Response.Redirect("/Error/NoPower?url=" + url);
                    }
                }
            }

            OnePointLogin();



            OperLog("/" + controllerName + "/" + actionName, filterContext, userName);



            base.OnActionExecuting(filterContext);
        }
Example #11
0
        public ActionResult SetGlobalEmailLimit()
        {
            UserLimit limit = SUBLL.GetLimitModel(new UserLimit {
                Category = 3, UserId = "0"
            });

            if (limit == null)
            {
                limit = new UserLimit()
                {
                    AccessNo = "20000,20,20000"
                };
            }

            return(View(limit));
        }
Example #12
0
        public ActionResult LogOff(Dictionary <string, string> queryvalues)
        {
            LogInfo info = new LogInfo()
            {
                UserAccount = User.Identity.Name,
                Detail      = "",
                Content     = "登出",
                CreateTime  = DateTime.Now,
                LoginIP     = Request.UserHostAddress,
                OperModule  = "登录后台"
            };

            SUBLL.AddLog(info);

            AuthenticationManager.SignOut();
            return(Json(new { result = Result.Normal }));
        }
Example #13
0
        public ActionResult SaveStockUser(Dictionary <string, string> queryvalues)
        {
            int    GroupID  = queryvalues.ContainsKey("GroupID") ? Convert.ToInt32(queryvalues["GroupID"]) : -1; //库组
            string UserName = queryvalues.ContainsKey("UserName") ? queryvalues["UserName"].ToString() : "";     //用户名

            //检测非法字符
            if (UserName.Contains("'"))
            {
                return(Content("2"));
            }
            //检测用户是否已经被其他的库存分配了
            if (UserName != "")
            {
                IEnumerable <UserStock> users = ServEmailBLL.GetOtherUsers(GroupID, UserName);
                if (users.Count() > 0)
                {
                    return(Content("3"));
                }

                //说明有用户不存在
                IEnumerable <AspNetUser> aspnetUsers = SUBLL.GetAspNetUsersByUserName(UserName);
                int num = UserName.Split(',').Length;
                if (aspnetUsers.Count() != num)
                {
                    return(Content("4"));
                }
            }
            //用户是否存在



            //Oper
            int res = ServEmailBLL.AddStockUser(GroupID, UserName);

            if (res >= 1)
            {
                return(Content("1"));
            }
            else
            {
                return(Content("0"));
            }
        }
Example #14
0
        public ActionResult SetSysEmailLimitForUpdate(string id)
        {
            ViewData["id"] = id;
            UserLimit limit = SUBLL.GetLimitModel(new UserLimit {
                Category = 1, UserId = id
            });
            Dictionary <int, string> dic = new Dictionary <int, string>();

            if (limit == null || string.IsNullOrEmpty(limit.AccessNo))
            {
                limit          = new UserLimit();
                limit.AccessNo = ",";
                dic.Add(1, "");
                dic.Add(2, "");
                dic.Add(3, "");
                dic.Add(4, "");
                dic.Add(5, "");
                dic.Add(6, "");
            }
            else
            {
                string lim = limit.AccessNo;

                // 1:1,2:22,3:,4:
                string[] strs = lim.Split(',');

                for (int i = 0; i < strs.Length; i++)
                {
                    string[] s = strs[i].Split(':');
                    dic.Add(Convert.ToInt32(s[0]), s[1]);
                }



                limit.AccessNo = "," + limit.AccessNo.Trim(',');
            }

            ViewData["dic"] = dic;

            return(View(limit));
        }