Пример #1
0
        public ActionResult Authority()
        {
            int    userid = (int)Session["user_id"];
            string jsid   = Request["jsid"] ?? "";

            if (jsid == "")
            {
                jsid = "0";
            }
            Iauth_jueseService jueseservice = ServiceFactory.auth_jueseservice;
            auth_juese         juese        = jueseservice.GetEntityById(auth_juese => auth_juese.ID == int.Parse(jsid) && auth_juese.IsDelete == false);

            if (juese == null)
            {
                return(View());
            }
            auth_authorizeViewModel authorview = new auth_authorizeViewModel();

            authorview.RoleID   = juese.ID;
            authorview.RoleName = juese.RoleName;
            IuserinfoService userservice = ServiceFactory.userinfoservice;
            IList <userinfo> users       = userservice.LoadSortEntities(userinfo => userinfo.IsDelete == false, true, userinfo => userinfo.FullName).ToList <userinfo>();
            //Iauth_quanxianService qxservice = ServiceFactory.auth_quanxianservice;
            IList <auth_quanxian> qxs = ob_auth_quanxianservice.LoadSortEntities(auth_quanxian => auth_quanxian.IsDelete == false && auth_quanxian.JSID == int.Parse(jsid), true, auth_quanxian => auth_quanxian.RYID).ToList <auth_quanxian>();

            authorview.AllUser        = users;
            authorview.AuthorizedUser = qxs;
            return(View(authorview));
        }
Пример #2
0
        public ActionResult Index(string page)
        {
            try
            {
                if (string.IsNullOrEmpty(page))
                {
                    page = "1";
                }
                int    userid  = (int)Session["user_id"];
                string pagetag = "userinfo_index";
                MakeSearch();
                Expression <Func <userinfo, bool> > where = PredicateExtensionses.True <userinfo>();
                searchcondition sc = searchconditionService.GetInstance().GetEntityById(searchcondition => searchcondition.UserID == userid && searchcondition.PageBrief == pagetag);
                if (sc != null)
                {
                    string[] sclist = sc.ConditionInfo.Split(';');
                    foreach (string scl in sclist)
                    {
                        string[] scld = scl.Split(',');
                        switch (scld[0])
                        {
                        case "account":
                            string account      = scld[1]; // Request["account"] ?? "";
                            string accountequal = scld[2]; // = Request["accountequal"] ?? "";
                            string accountand   = scld[3]; //Request["accountand"] ?? "";
                            if (!string.IsNullOrEmpty(account))
                            {
                                if (accountequal.Equals("="))
                                {
                                    if (accountand.Equals("and"))
                                    {
                                        where = where.And(userinfo => userinfo.Account == account);
                                    }
                                    else
                                    {
                                        where = where.Or(userinfo => userinfo.Account == account);
                                    }
                                }
                                if (accountequal.Equals("like"))
                                {
                                    if (accountand.Equals("and"))
                                    {
                                        where = where.And(userinfo => userinfo.Account.Contains(account));
                                    }
                                    else
                                    {
                                        where = where.Or(userinfo => userinfo.Account.Contains(account));
                                    }
                                }
                            }
                            break;

                        default:
                            break;
                        }
                    }
                    ViewBag.SearchCondition = sc.ConditionInfo;
                }

                where = where.And(userinfo => userinfo.IsDelete == false);

                var tempData = ob_userinfoservice.LoadSortEntities(where.Compile(), false, userinfo => userinfo.ID).ToPagedList <userinfo>(int.Parse(page), int.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["ShowPerPage"]));
                //var tempData = ob_userinfoservice.LoadPageEntities(int.Parse(index),int.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["ShowPerPage"]), out itotal, where.Compile(), false, userinfo => userinfo.ID);
                //ViewBag.userinfo = tempData;
                //log4net.LogManager.GetLogger(Session["user_id"].ToString()).Error("user list now");
                //ViewBag.SearchCondition = _searchconditions;
                return(View(tempData));
            }
            catch (Exception ex)
            {
                log4net.LogManager.GetLogger("AppLog").Error(string.Format("userinfo,{0}", ex.Message));
                return(RedirectToAction("Index", "Home"));
            }
        }