public ActionResult ShopPermission(OneKeySearchModel searchModel)
        {
            //IUsersService usersService = ServiceFactory.Create<IUsersService>();
            Expression <Func <Shops, Boolean> > lbdWhere = null;

            if (searchModel.SearchStr != null)
            {
                searchModel.SearchStr = searchModel.SearchStr.Trim();
                if (!string.IsNullOrWhiteSpace(searchModel.SearchStr))
                {
                    lbdWhere = t => t.ShopName.Contains(searchModel.SearchStr);
                }
            }
            IShopsService shopsService = ServiceFactory.Create <IShopsService>();
            var           shops        = shopsService.GetEntitiesByPage(searchModel.PageIndex, 10, lbdWhere, false, t => t.ID);
            //转换数据模型
            var listData = shops.Models.Select(t => new ShopPermissionListModel
            {
                ID       = t.ID,
                ShopName = t.ShopName,
                RealName = ServiceHelper.GetUsersService.GetEntity(t.AdminUserID).RealName,// t.Users.RealName,
                Phone    = ServiceHelper.GetUsersService.GetEntity(t.AdminUserID).Phone
            });

            var listShop = new PageModel <ShopPermissionListModel>
            {
                Models     = listData.ToList(),
                pagingInfo = shops.pagingInfo
            };

            ViewBag.SearchModel = searchModel;

            return(View(listShop));
        }
Esempio n. 2
0
        // GET: Admin/ShopVersion
        public ActionResult Index(OneKeySearchModel searchModel)
        {
            //如果不是管理员,拒绝访问
            if (!CurrentInfo.IsAdministrator)
            {
                return(RedirectToAction("Error403", "Home", new { area = "Admin" }));
            }

            Expression <Func <ShopVersion, Boolean> > lbdWhere = null;

            if (searchModel.SearchStr != null)
            {
                searchModel.SearchStr = searchModel.SearchStr.Trim();
                if (!string.IsNullOrWhiteSpace(searchModel.SearchStr))
                {
                    lbdWhere = t => t.Name.Contains(searchModel.SearchStr);
                }
            }


            IShopVersionService shopVersionService = ServiceFactory.Create <IShopVersionService>();
            var shopVersions = shopVersionService.GetEntitiesByPage(searchModel.PageIndex, 20, lbdWhere, true, t => t.Short);

            ViewBag.SearchModel = searchModel;
            return(View(shopVersions));
        }
Esempio n. 3
0
        // GET: Admin/User
        public ActionResult Index(OneKeySearchModel searchModel)
        {
            Expression <Func <Users, Boolean> > lbdWhere = null;

            if (searchModel.SearchStr != null)
            {
                searchModel.SearchStr = searchModel.SearchStr.Trim();
                if (!string.IsNullOrWhiteSpace(searchModel.SearchStr))
                {
                    lbdWhere = t => t.RealName.Contains(searchModel.SearchStr) ||
                               t.UserName.Contains(searchModel.SearchStr) ||
                               t.Phone.Contains(searchModel.SearchStr) ||
                               t.TEL.Contains(searchModel.SearchStr) ||
                               t.Idcard.Contains(searchModel.SearchStr) ||
                               t.WorkNum.Contains(searchModel.SearchStr) ||
                               t.UserName.Contains(searchModel.SearchStr) ||
                               t.Stores.Shops.ShopName.Contains(searchModel.SearchStr) ||
                               t.Stores.StoreName.Contains(searchModel.SearchStr);
                }
            }

            IUsersService usersService = ServiceFactory.Create <IUsersService>();
            var           users        = usersService.GetEntitiesByPage(searchModel.PageIndex, 10, lbdWhere, false, t => t.ID);

            ////该用户在当前门店下的所有角色
            //var userAllRole =ServiceHelper.GetUsersService.GetEntity(0).RelationUserRole;
            ////过滤出用户当前门店的所有角色
            //var userCurrentStoreRole = userAllRole.Where(t => t.Role.StoreID == currentSore.ID);

            ////当前用户使用的角色名称
            //initInfo.CurrentRoleName = string.Join(",", userCurrentStoreRole.Select(t => t.Role.Name).ToList());

            //转换数据模型
            var listData = users.Models.Select(t => new UserListModel
            {
                ID            = t.ID,
                WorkNum       = t.WorkNum,
                RealName      = t.RealName,
                Phone         = t.Phone,
                RoleName      = ServiceHelper.GetUsersService.GetUserAllRole(t.ID),//t.WorkTypeID == null ? "" : workTypeService.GetEntity(Convert.ToInt32(t.WorkTypeID)).WorkTypeName,
                UserName      = t.UserName,
                BasicSalary   = t.BasicSalary,
                WeiXinVisible = t.WeiXinVisible == true ? "显示" : "隐藏",
                Idcard        = t.Idcard,
                ShopName      = t.Stores.Shops.ShopName,
                StoreName     = t.Stores.StoreName,
                CreateTime    = t.CreateTime,
                Disabled      = t.Disabled
            });

            var listUser = new PageModel <UserListModel>
            {
                Models     = listData.ToList(),
                pagingInfo = users.pagingInfo
            };

            ViewBag.SearchModel = searchModel;

            return(View(listUser));
        }
        // GET: Admin/Permission
        public ActionResult UserPermission(OneKeySearchModel searchModel)
        {
            Expression <Func <Users, Boolean> > lbdWhere = null;

            if (searchModel.SearchStr != null)
            {
                searchModel.SearchStr = searchModel.SearchStr.Trim();
                if (!string.IsNullOrWhiteSpace(searchModel.SearchStr))
                {
                    lbdWhere = t => t.UserName.Contains(searchModel.SearchStr) ||
                               t.Phone.Contains(searchModel.SearchStr) ||
                               t.TEL.Contains(searchModel.SearchStr) ||
                               t.Idcard.Contains(searchModel.SearchStr) ||
                               t.WorkNum.Contains(searchModel.SearchStr) ||
                               t.RealName.Contains(searchModel.SearchStr) ||
                               t.UserName.Contains(searchModel.SearchStr) ||
                               t.Stores.Shops.ShopName.Contains(searchModel.SearchStr) ||
                               t.Stores.StoreName.Contains(searchModel.SearchStr);
                }
            }


            IUsersService usersService = ServiceFactory.Create <IUsersService>();
            var           users        = usersService.GetEntitiesByPage(searchModel.PageIndex, 10, lbdWhere, false, t => t.ID);
            //IWorkTypeService workTypeService = ServiceFactory.Create<IWorkTypeService>();

            //转换数据模型
            var listData = users.Models.Select(t => new UserListModel
            {
                ID            = t.ID,
                WorkNum       = t.WorkNum,
                RealName      = t.RealName,
                Phone         = t.Phone,
                RoleName      = ServiceHelper.GetUsersService.GetUserAllRole(t.ID),//t.WorkTypeID == null ? "" : workTypeService.GetEntity(Convert.ToInt32(t.WorkTypeID)).WorkTypeName,
                UserName      = t.UserName,
                WeiXinVisible = t.WeiXinVisible == true ? "显示" : "隐藏",
                Idcard        = t.Idcard,
                ShopName      = t.Stores.Shops.ShopName,
                StoreName     = t.Stores.StoreName,
                CreateTime    = t.CreateTime,
                Disabled      = t.Disabled
            });

            var listUser = new PageModel <UserListModel>
            {
                Models     = listData.ToList(),
                pagingInfo = users.pagingInfo
            };

            ViewBag.SearchModel = searchModel;

            return(View(listUser));
        }
Esempio n. 5
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <Users, Boolean> > BuildSearchCriteria(OneKeySearchModel searchModel)
        {
            DynamicLambda <Users> bulider            = new DynamicLambda <Users>();
            Expression <Func <Users, Boolean> > expr = null;

            //判断是否是商家的总账号,如果是的话,可以看所有员工的数据,否则只能看自己门店的数据
            if (CurrentInfo.IsShopAdmin)
            {
                //IStoresService storesService = ServiceFactory.Create<IStoresService>();
                //List<int> allStoresID = storesService.GetEntities(t => t.ShopId == CurrentInfo.CurrentShop.ID && t.Disabled == false).Select(t => t.ID).ToList();
                //foreach (var item in allStoresID)
                //{

                //}
                Expression <Func <Users, Boolean> > tmpStoreID = t => t.ShopsID == CurrentInfo.CurrentShop.ID && t.IsIntention != true;
                expr = bulider.BuildQueryAnd(expr, tmpStoreID);
            }
            else
            {
                Expression <Func <Users, Boolean> > tmpStoreID = t => t.DefaultStoreID == CurrentInfo.CurrentStore.ID && t.IsIntention != true;
                expr = bulider.BuildQueryAnd(expr, tmpStoreID);
            }

            if (searchModel.SearchStr != null)
            {
                searchModel.SearchStr = searchModel.SearchStr.Trim();
                if (!string.IsNullOrWhiteSpace(searchModel.SearchStr))
                {
                    Expression <Func <Users, Boolean> > tmpUser = t => (t.UserName.Contains(searchModel.SearchStr) ||
                                                                        t.Phone.Contains(searchModel.SearchStr) ||
                                                                        t.TEL.Contains(searchModel.SearchStr) ||
                                                                        t.Idcard.Contains(searchModel.SearchStr) ||
                                                                        t.WorkNum.Contains(searchModel.SearchStr) ||
                                                                        t.RealName.Contains(searchModel.SearchStr));

                    expr = bulider.BuildQueryAnd(expr, tmpUser);
                }
            }

            //如果是意向客户 把测试管理员账号和内部销售的账号过滤掉
            if (CurrentInfo.CurrentUser.IsIntention == true)
            {
                Expression <Func <Users, Boolean> > tmpAdmin = t => t.Remark != "B4内部销售" && t.Remark != "B4内部售后";
                expr = bulider.BuildQueryAnd(expr, tmpAdmin);
            }

            return(expr);
        }
        public ActionResult StorePermission(OneKeySearchModel searchModel)
        {
            Expression <Func <Stores, Boolean> > lbdWhere = null;

            if (searchModel.SearchStr != null)
            {
                searchModel.SearchStr = searchModel.SearchStr.Trim();
                if (!string.IsNullOrWhiteSpace(searchModel.SearchStr))
                {
                    lbdWhere = t => t.StoreName.Contains(searchModel.SearchStr) ||
                               t.Phone.Contains(searchModel.SearchStr) ||
                               t.Adress.Contains(searchModel.SearchStr) ||
                               t.Shops.ShopName.Contains(searchModel.SearchStr);
                }
            }


            IStoresService storesService = ServiceFactory.Create <IStoresService>();
            var            stores        = storesService.GetEntitiesByPage(searchModel.PageIndex, 10, lbdWhere, false, t => t.ID);
            //转换数据模型
            var listData = stores.Models.Select(t => new StorePermissionListModel
            {
                ID           = t.ID,
                ShopName     = t.Shops.ShopName,
                StoreName    = t.StoreName,
                Phone        = t.Phone,
                Adress       = t.Adress,
                IsShowWeiXin = t.IsShowWeiXin == true ? "显示" : "不显示",
                IsMainStore  = t.IsMainStore == true ? "是" : "否"//是否总店
            });

            var listStore = new PageModel <StorePermissionListModel>
            {
                Models     = listData.ToList(),
                pagingInfo = stores.pagingInfo
            };

            ViewBag.SearchModel = searchModel;

            return(View(listStore));
        }
Esempio n. 7
0
        public ActionResult CusUserManage(OneKeySearchModel searchModel)
        {
            Expression <Func <Users, Boolean> > lbdWhere = BuildSearchCriteria(searchModel);


            IUsersService usersService = ServiceFactory.Create <IUsersService>();
            var           users        = usersService.GetEntitiesByPage(searchModel.PageIndex, 10, lbdWhere, false, t => t.ID);

            //var ddddd = users.Models.ToList();

            //转换数据模型
            var listData = users.Models.Select(t => new UserListModel
            {
                ID            = t.ID,
                WorkNum       = t.WorkNum,
                RealName      = t.RealName,
                Phone         = t.Phone,
                BasicSalary   = t.BasicSalary,
                WeiXinVisible = t.WeiXinVisible == true ? "显示" : "隐藏",
                UserName      = t.UserName,
                Idcard        = t.Idcard,
                StoreName     = t.Stores.StoreName,
                CreateTime    = t.CreateTime,
                Disabled      = t.Disabled
            });


            var listUser = new PageModel <UserListModel>
            {
                Models     = listData.ToList(),
                pagingInfo = users.pagingInfo
            };

            ViewBag.SearchModel = searchModel;

            return(View(listUser));
        }