/// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <SystemDepartment, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <SystemDepartment> bulider            = new DynamicLambda <SystemDepartment>();
            Expression <Func <SystemDepartment, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["Name"]))
            {
                var data = Request["Name"].Trim();
                Expression <Func <SystemDepartment, Boolean> > tmp = t => t.Name.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (Request["Enabled"] == "0" || Request["Enabled"] == "1")
            {
                var data = Request["Enabled"] == "1" ? true : false;
                Expression <Func <SystemDepartment, Boolean> > tmp = t => t.Enabled == data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["ParentId"]) && Request["ParentId"] != "0")
            {
                var data = Convert.ToInt32(Request["ParentId"]);
                Expression <Func <SystemDepartment, Boolean> > tmp = t => (t.ParentID == data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            Expression <Func <SystemDepartment, Boolean> > tmpSolid = t => t.IsDeleted == false;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);

            return(expr);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <Role, Boolean> > BuildSearchCriteria(SearchModel search)
        {
            DynamicLambda <Role> bulider            = new DynamicLambda <Role>();
            Expression <Func <Role, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["Name"]))
            {
                var data = Request["Name"].Trim();
                Expression <Func <Role, Boolean> > tmp = t => t.Name.Contains(data);
                expr        = bulider.BuildQueryAnd(expr, tmp);
                search.Name = data;
            }
            if (Request["Enabled"] == "0" || Request["Enabled"] == "1")
            {
                var data = Request["Enabled"] == "1" ? true : false;
                Expression <Func <Role, Boolean> > tmp = t => t.Enabled == data;
                expr = bulider.BuildQueryAnd(expr, tmp);
                search.EnabledStr = Request["Enabled"];
            }

            Expression <Func <Role, Boolean> > tmpSolid = t => t.IsDeleted == false;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);

            return(expr);
        }
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <PROD_GROUP_INDEX, Boolean> > BuildSearchCriteria(string id)
        {
            DynamicLambda <PROD_GROUP_INDEX> bulider            = new DynamicLambda <PROD_GROUP_INDEX>();
            Expression <Func <PROD_GROUP_INDEX, Boolean> > expr = null;

            /*
             * if (!string.IsNullOrEmpty(Request["Name"]))
             * {
             *  var data = Request["Name"].Trim();
             *  Expression<Func<PROD_GROUP_INDEX, Boolean>> tmp = t => t.Name.Contains(data);
             *  expr = bulider.BuildQueryAnd(expr, tmp);
             * }
             * if (!string.IsNullOrEmpty(Request["ParentID"]))
             * {
             *  var data = Request["ParentID"].Trim();
             *  Expression<Func<PROD_GROUP_INDEX, Boolean>> tmp = t => t.ParentID.Contains(data);
             *  expr = bulider.BuildQueryAnd(expr, tmp);
             * }
             * //if (!string.IsNullOrEmpty(id))
             * //{
             * //    Expression<Func<PROD_GROUP_INDEX, Boolean>> tmp = t => t.ParentID == id;
             * //    expr = bulider.BuildQueryAnd(expr, tmp);
             * //}
             *
             * if (Request["Status"] == "0" || Request["Status"] == "1")
             * {
             *  var data = Request["Status"] == "1" ? 1 : 0;
             *  Expression<Func<PROD_GROUP_INDEX, Boolean>> tmp = t => t.Status == data;
             *  expr = bulider.BuildQueryAnd(expr, tmp);
             * }*/
            Expression <Func <PROD_GROUP_INDEX, Boolean> > tmpSolid = t => t.ParentID == id;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);
            return(expr);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <Device, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <Device> bulider            = new DynamicLambda <Device>();
            Expression <Func <Device, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["DeviceCode"]))
            {
                var data = Request["DeviceCode"].Trim();
                Expression <Func <Device, Boolean> > tmp = t => t.DeviceCode.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            if (!string.IsNullOrEmpty(Request["Name"]))
            {
                var data = Request["Name"].Trim();
                Expression <Func <Device, Boolean> > tmp = t => t.DeviceName.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            if (!string.IsNullOrEmpty(Request["AreaList"]))
            {
                var data = Request["AreaList"].GetInt(0);
                if (data > 0)
                {
                    Expression <Func <Device, Boolean> > tmp = t => t.AreaId == data;
                    expr = bulider.BuildQueryAnd(expr, tmp);
                }
            }

            Expression <Func <Device, Boolean> > tmpSolid = (t => t.IsDeleted == null || t.IsDeleted.Value == false);

            expr = bulider.BuildQueryAnd(expr, tmpSolid);

            return(expr);
        }
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <INFOR_MASTER, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <INFOR_MASTER> bulider            = new DynamicLambda <INFOR_MASTER>();
            Expression <Func <INFOR_MASTER, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["Subject"]))
            {
                var data = Request["Subject"].Trim();
                Expression <Func <INFOR_MASTER, Boolean> > tmp = t => t.InforSubject.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["InforCategoryID"]))
            {
                var data = Request["InforCategoryID"].Trim();
                Expression <Func <INFOR_MASTER, Boolean> > tmp = t => t.InforCategoryID.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (Request["Enabled"] == "0" || Request["Enabled"] == "1")
            {
                var data = Request["Enabled"] == "1" ? 1 : 0;
                Expression <Func <INFOR_MASTER, Boolean> > tmp = t => t.Status == data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            Expression <Func <INFOR_MASTER, Boolean> > tmpSolid = t => 1 == 1;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);
            return(expr);
        }
Exemplo n.º 6
0
        private Expression <Func <MD.tbl_Common_User, bool> > BuildSearchCriteria(VM.UserInfoSearch searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException("searchModel is null.");
            }

            Expression <Func <MD.tbl_Common_User, bool> > expr    = null;
            DynamicLambda <MD.tbl_Common_User>            builder = new DynamicLambda <MD.tbl_Common_User>();

            if (searchModel.BeginDate.HasValue)
            {
                Expression <Func <MD.tbl_Common_User, bool> > temp = s => s.CreatedDate >= searchModel.BeginDate;
                expr = builder.BuildQueryAnd(expr, temp);
            }
            if (searchModel.EndDate.HasValue)
            {
                Expression <Func <MD.tbl_Common_User, bool> > temp = s => s.CreatedDate <= searchModel.EndDate;
                expr = builder.BuildQueryAnd(expr, temp);
            }
            if (searchModel.LogonName != null)
            {
                Expression <Func <MD.tbl_Common_User, Boolean> > temp = s => s.LogonName.Contains(searchModel.LogonName);
                expr = builder.BuildQueryAnd(expr, temp);
            }
            if (searchModel.UserName != null)
            {
                Expression <Func <MD.tbl_Common_User, Boolean> > temp = s => s.UserName.Contains(searchModel.UserName);
                expr = builder.BuildQueryAnd(expr, temp);
            }

            return(expr);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <Admin_user, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <Admin_user> bulider            = new DynamicLambda <Admin_user>();
            Expression <Func <Admin_user, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["Id"]))
            {
                var data = Request["Id"].Trim();
                Expression <Func <Admin_user, Boolean> > tmp = t => t.Id.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Name"]))
            {
                var data = Request["Name"].Trim();
                Expression <Func <Admin_user, Boolean> > tmp = t => t.Name.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Userid"]))
            {
                var data = Request["Userid"].Trim();
                Expression <Func <Admin_user, Boolean> > tmp = t => t.Userid.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Passid"]))
            {
                var data = Request["Passid"].Trim();
                Expression <Func <Admin_user, Boolean> > tmp = t => t.Passid.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Usertype"]))
            {
                var data = Request["Usertype"].Trim();
                Expression <Func <Admin_user, Boolean> > tmp = t => t.Usertype.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Fname"]))
            {
                var data = Request["Fname"].Trim();
                Expression <Func <Admin_user, Boolean> > tmp = t => t.Fname.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Lname"]))
            {
                var data = Request["Lname"].Trim();
                Expression <Func <Admin_user, Boolean> > tmp = t => t.Lname.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Mname"]))
            {
                var data = Request["Mname"].Trim();
                Expression <Func <Admin_user, Boolean> > tmp = t => t.Mname.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            return(expr);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <Privileges, Boolean> > BuildSearchCriteria(int?moduleID)
        {
            DynamicLambda <Privileges> bulider            = new DynamicLambda <Privileges>();
            Expression <Func <Privileges, Boolean> > expr = null;

            if (moduleID != 0 && moduleID != null)
            {
                Expression <Func <Privileges, Boolean> > tmpStoreID = t => t.ModuleID == moduleID;
                expr = bulider.BuildQueryAnd(expr, tmpStoreID);
            }
            return(expr);
        }
Exemplo n.º 9
0
        private Expression <Func <MD.Common_Authen_Role, bool> > BuildSearchCriteria(VM.RoleSearchModel search)
        {
            Expression <Func <MD.Common_Authen_Role, bool> > expr  = null;
            DynamicLambda <MD.Common_Authen_Role>            bulid = new DynamicLambda <MD.Common_Authen_Role>();

            if (!string.IsNullOrEmpty(search.RoleName))
            {
                Expression <Func <MD.Common_Authen_Role, bool> > temp = s => s.RoleName.Contains(search.RoleName);
                expr = bulid.BuildQueryAnd(expr, temp);
            }
            return(expr);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <User, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <User> bulider            = new DynamicLambda <User>();
            Expression <Func <User, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["LoginName"]))
            {
                var data = Request["LoginName"].Trim();
                Expression <Func <User, Boolean> > tmp = t => t.UserCode.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["FullName"]))
            {
                var data = Request["FullName"].Trim();
                Expression <Func <User, Boolean> > tmp = t => t.UserName.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Email"]))
            {
                var data = Request["Email"].Trim();
                Expression <Func <User, Boolean> > tmp = t => t.Memo.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Phone"]))
            {
                var data = Request["Phone"].Trim();
                Expression <Func <User, Boolean> > tmp = t => t.Tel.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (Request["Enabled"] == "0" || Request["Enabled"] == "1")
            {
                var data = Request["Enabled"] == "1" ? true: false;
                Expression <Func <User, Boolean> > tmp = t => t.Enabled == data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["StartTime"]))
            {
                var data = Convert.ToDateTime(Request["StartTime"].Trim());
                Expression <Func <User, Boolean> > tmp = t => t.RegisterTime >= data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["EndTime"]))
            {
                var data = Convert.ToDateTime(Request["EndTime"].Trim()).AddDays(1);
                Expression <Func <User, Boolean> > tmp = t => t.RegisterTime <= data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            Expression <Func <User, Boolean> > tmpSolid = t => t.IsDeleted == false;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);

            return(expr);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <OperateLog, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <OperateLog> bulider            = new DynamicLambda <OperateLog>();
            Expression <Func <OperateLog, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["Area"]))
            {
                var data = Request["Area"].Trim();
                Expression <Func <OperateLog, Boolean> > tmp = t => t.Area.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Controller"]))
            {
                var data = Request["Controller"].Trim();
                Expression <Func <OperateLog, Boolean> > tmp = t => t.Controller.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["Action"]))
            {
                var data = Request["Action"].Trim();
                Expression <Func <OperateLog, Boolean> > tmp = t => t.Action.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["IPAddress"]))
            {
                var data = Request["IPAddress"].Trim();
                Expression <Func <OperateLog, Boolean> > tmp = t => t.IPAddress.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["LoginName"]))
            {
                var data = Request["LoginName"].Trim();
                Expression <Func <OperateLog, Boolean> > tmp = t => t.LoginName.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["StartTime"]))
            {
                var data = Convert.ToDateTime(Request["StartTime"].Trim());
                Expression <Func <OperateLog, Boolean> > tmp = t => t.LogTime >= data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["EndTime"]))
            {
                var data = Convert.ToDateTime(Request["EndTime"].Trim()).AddDays(1);
                Expression <Func <OperateLog, Boolean> > tmp = t => t.LogTime <= data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            Expression <Func <OperateLog, Boolean> > tmpSolid = t => t.IsDeleted == false;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);

            return(expr);
        }
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <Role, Boolean> > BuildSearchCriteria(RoleSearchModel searchModel)
        {
            DynamicLambda <Role> bulider            = new DynamicLambda <Role>();
            Expression <Func <Role, Boolean> > expr = null;

            if (!string.IsNullOrWhiteSpace(searchModel.RoleName))
            {
                Expression <Func <Role, Boolean> > tmp = t => t.Name.Contains(searchModel.RoleName);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            if (!string.IsNullOrWhiteSpace(searchModel.Disabled))
            {
                var flage = searchModel.Disabled == "1" ? true : false;
                Expression <Func <Role, Boolean> > tmp = t => t.Disabled == flage;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            if (!string.IsNullOrWhiteSpace(searchModel.startDate))
            {
                try
                {
                    DateTime dt = Convert.ToDateTime(searchModel.startDate);
                    Expression <Func <Role, Boolean> > tmp = t => t.CreateTime >= dt;
                    expr = bulider.BuildQueryAnd(expr, tmp);
                }
                catch
                {
                }
            }

            if (!string.IsNullOrWhiteSpace(searchModel.endDate))
            {
                try
                {
                    DateTime dt = Convert.ToDateTime(searchModel.endDate).AddDays(1);
                    Expression <Func <Role, Boolean> > tmp = t => t.CreateTime < dt;
                    expr = bulider.BuildQueryAnd(expr, tmp);
                }
                catch
                {
                }
            }

            //Expression<Func<Role, Boolean>> tmpSolid = t => t.IsDeleted == false;
            //expr = bulider.BuildQueryAnd(expr, tmpSolid);

            return(expr);
        }
Exemplo n.º 13
0
        private Expression <Func <MD.Common.Common_Authen_User, bool> > BuildSearchCriteria(VM.UserSearchModel search)
        {
            Expression <Func <MD.Common.Common_Authen_User, bool> > expr  = null;
            DynamicLambda <MD.Common.Common_Authen_User>            bulid = new DynamicLambda <MD.Common.Common_Authen_User>();

            if (!string.IsNullOrEmpty(search.LogonName))
            {
                Expression <Func <MD.Common.Common_Authen_User, bool> > temp = s => s.LogonName.Contains(search.LogonName);
                expr = bulid.BuildQueryAnd(expr, temp);
            }
            Expression <Func <MD.Common.Common_Authen_User, bool> > solidFilter = s => (s.Status == 1);

            expr = bulid.BuildQueryAnd(expr, solidFilter);
            return(expr);
        }
Exemplo n.º 14
0
        private Expression <Func <user, Boolean> > BuildSearchCriteria(SearchModel model)
        {
            DynamicLambda <user> bulider            = new DynamicLambda <user>();
            Expression <Func <user, Boolean> > expr = t => t.deleted == 0;

            ///电话号码
            if (!string.IsNullOrEmpty(Request["mobile"]))
            {
                var data = Request["mobile"].Trim();
                Expression <Func <user, Boolean> > tmp = t => t.mobile == data;
                expr         = bulider.BuildQueryAnd(expr, tmp);
                model.mobile = data;
            }
            return(expr);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
0
        /// <summary>
	    /// 构建查询表达式
	    /// </summary>
	    /// <returns></returns>
	    private Expression<Func<Permission, Boolean>> BuildSearchCriteria()
	    {
		    DynamicLambda<Permission> bulider = new DynamicLambda<Permission>();
		    Expression<Func<Permission, Boolean>> expr = null;
		    if (!string.IsNullOrEmpty(Request["Name"]))
		    {
			    var data = Request["Name"].Trim();
			    Expression<Func<Permission, Boolean>> tmp = t => t.Name.Contains(data);
			    expr = bulider.BuildQueryAnd(expr, tmp);
		    }

		    Expression<Func<Permission, Boolean>> tmpSolid = t => t.IsDeleted == false;
		    expr = bulider.BuildQueryAnd(expr, tmpSolid);

		    return expr;
	    }
Exemplo n.º 17
0
        private Expression <Func <ELMAH_Error, bool> > BuildSearchCriteria(ELMAH_Error_SearchModel search)
        {
            Expression <Func <ELMAH_Error, bool> > expr  = null;
            DynamicLambda <ELMAH_Error>            bulid = new DynamicLambda <ELMAH_Error>();

            //if (!string.IsNullOrEmpty(search.StatusCode))
            if (search.StatusCode > 0)
            {
                Expression <Func <ELMAH_Error, bool> > temp = s => (s.StatusCode == search.StatusCode);
                expr = bulid.BuildQueryAnd(expr, temp);
            }
            Expression <Func <ELMAH_Error, bool> > solidFilter = s => (s.Sequence > 0);

            expr = bulid.BuildQueryAnd(expr, solidFilter);
            return(expr);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 账户登录
        /// </summary>
        /// <param name="loginname">邮箱/用户名/已验证手机</param>
        /// <param name="password">登录密码</param>
        /// <returns></returns>
        public ActionResult Signin(string loginname, string password)
        {
            DynamicLambda <user> bulider            = new DynamicLambda <user>();
            Expression <Func <user, Boolean> > expr = x => x.deleted == 0 && x.password == password;

            if (true)
            {
                //邮箱登录
                Expression <Func <user, Boolean> > tmp = x => x.email == loginname;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            else if (true)
            {
                //手机号登录
                Expression <Func <user, Boolean> > tmp = x => x.mobile == loginname;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            else if (true)
            {
                //用户名登录
                Expression <Func <user, Boolean> > tmp = x => x.username == loginname;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            else
            {
                //格式不正确
                return(Show(new { }));
            }
            var userlist = UserService.user.Where(expr).ToList();

            if (userlist.Count == 0)
            {
                //账号或密码不正确
                return(Show(new { }));
            }
            else if (userlist.Count == 1)
            {
                //登录成功
                return(Show(new { }));
            }
            else
            {
                //账号异常,封停账号,记录日志
                return(Show(new { }));
            }
        }
Exemplo n.º 19
0
        private Expression <Func <MD.tbl_Common_Resource, bool> > BuildSearchCriteria(VM.ResourceInfoSearch searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException("searchModel is null.");
            }

            Expression <Func <MD.tbl_Common_Resource, bool> > expr    = null;
            DynamicLambda <MD.tbl_Common_Resource>            builder = new DynamicLambda <MD.tbl_Common_Resource>();

            if (searchModel.ResourceKey != null)
            {
                Expression <Func <MD.tbl_Common_Resource, bool> > temp = s => s.ResourceKey.Contains(searchModel.ResourceKey);
                expr = builder.BuildQueryAnd(expr, temp);
            }
            return(expr);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <ReceiptHeaderEntity, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <ReceiptHeaderEntity> bulider            = new DynamicLambda <ReceiptHeaderEntity>();
            Expression <Func <ReceiptHeaderEntity, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["F_Code"]))
            {
                var data = Request["F_Code"].Trim();
                Expression <Func <ReceiptHeaderEntity, Boolean> > tmp = t => t.F_Code.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            Expression <Func <ReceiptHeaderEntity, Boolean> > tmpSolid = t => t.F_DeleteMark == false;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);

            return(expr);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <PROD_GROUP_ITEM, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <PROD_GROUP_ITEM> bulider            = new DynamicLambda <PROD_GROUP_ITEM>();
            Expression <Func <PROD_GROUP_ITEM, Boolean> > expr = null;

            /*
             * if (Request["Enabled"] == "0" || Request["Enabled"] == "1")
             * {
             *  var data = Request["Enabled"] == "1" ? 1 : 0;
             *  Expression<Func<PROD_GROUP_ITEM, Boolean>> tmp = t => t.Status == data;
             *  expr = bulider.BuildQueryAnd(expr, tmp);
             * }
             */
            Expression <Func <PROD_GROUP_ITEM, Boolean> > tmpSolid = t => 1 == 1;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);
            return(expr);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <PROD_MASTER, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <PROD_MASTER> bulider            = new DynamicLambda <PROD_MASTER>();
            Expression <Func <PROD_MASTER, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["ProductName"]))
            {
                var data = Request["ProductName"].Trim();
                Expression <Func <PROD_MASTER, Boolean> > tmp = t => t.ProductName.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["ProductNo"]))
            {
                var data = Request["ProductNo"].Trim();
                Expression <Func <PROD_MASTER, Boolean> > tmp = t => t.ProductNo.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (Request["Enabled"] == "0" || Request["Enabled"] == "1")
            {
                var data = Request["Enabled"] == "1" ? 1 : 0;
                Expression <Func <PROD_MASTER, Boolean> > tmp = t => t.Status == data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            if (!string.IsNullOrEmpty(Request["StartTime"]))
            {
                var data = Convert.ToDateTime(Request["StartTime"].Trim());
                Expression <Func <PROD_MASTER, Boolean> > tmp = t => t.LeadTime >= data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (!string.IsNullOrEmpty(Request["EndTime"]))
            {
                var data = Convert.ToDateTime(Request["EndTime"].Trim()).AddDays(1);
                Expression <Func <PROD_MASTER, Boolean> > tmp = t => t.LeadTime <= data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            Expression <Func <PROD_MASTER, Boolean> > tmpSolid = t => 1 == 1;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);

            return(expr);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <PROD_PROPERTIES, Boolean> > BuildSearchCriteria()
        {
            DynamicLambda <PROD_PROPERTIES> bulider            = new DynamicLambda <PROD_PROPERTIES>();
            Expression <Func <PROD_PROPERTIES, Boolean> > expr = null;

            /*
             * if (!string.IsNullOrEmpty(Request["ProductName"]))
             * {
             *  var data = Request["ProductName"].Trim();
             *  Expression<Func<PROD_PROPERTIES, Boolean>> tmp = t => t.ProductName.Contains(data);
             *  expr = bulider.BuildQueryAnd(expr, tmp);
             * }
             * if (!string.IsNullOrEmpty(Request["Description"]))
             * {
             *  var data = Request["Description"].Trim();
             *  Expression<Func<PROD_PROPERTIES, Boolean>> tmp = t => t.Description.Contains(data);
             *  expr = bulider.BuildQueryAnd(expr, tmp);
             * }
             * if (Request["Enabled"] == "0" || Request["Enabled"] == "1")
             * {
             *  var data = Request["Enabled"] == "1" ? 1 : 0;
             *  Expression<Func<PROD_PROPERTIES, Boolean>> tmp = t => t.Status == data;
             *  expr = bulider.BuildQueryAnd(expr, tmp);
             * }
             *
             * if (!string.IsNullOrEmpty(Request["StartTime"]))
             * {
             *  var data = Convert.ToDateTime(Request["StartTime"].Trim());
             *  Expression<Func<PROD_PROPERTIES, Boolean>> tmp = t => t.LeadTime >= data;
             *  expr = bulider.BuildQueryAnd(expr, tmp);
             * }
             * if (!string.IsNullOrEmpty(Request["EndTime"]))
             * {
             *  var data = Convert.ToDateTime(Request["EndTime"].Trim()).AddDays(1);
             *  Expression<Func<PROD_PROPERTIES, Boolean>> tmp = t => t.LeadTime <= data;
             *  expr = bulider.BuildQueryAnd(expr, tmp);
             * }
             */
            Expression <Func <PROD_PROPERTIES, Boolean> > tmpSolid = t => 1 == 1;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);
            return(expr);
        }
Exemplo n.º 24
0
        private Expression <Func <PROD_CATEGORIES, Boolean> > BuildStairCategories(string cateCode)
        {
            DynamicLambda <PROD_CATEGORIES> bulider            = new DynamicLambda <PROD_CATEGORIES>();
            Expression <Func <PROD_CATEGORIES, Boolean> > expr = t => t.Status == 0 && t.IsAvailably;

            if (!string.IsNullOrEmpty(cateCode))
            {
                var list = PROD_CATEGORIESService.PROD_CATEGORIESList
                           .Where(t => t.CategoryCode.Equals(cateCode))
                           .Select(t => t.ID);
                Expression <Func <PROD_CATEGORIES, Boolean> > tmpSolid = t => list.Contains(t.ParentID);
                expr = bulider.BuildQueryAnd(expr, tmpSolid);
            }
            //if (!string.IsNullOrEmpty(parentID))
            //{
            //    Expression<Func<PROD_CATEGORIES, Boolean>> tmpP = t => t.ParentID.Contains(parentID);
            //    expr = bulider.BuildQueryAnd(expr, tmpP);
            //}
            return(expr);
        }
Exemplo n.º 25
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <Shops, Boolean> > BuildSearchCriteria(string strSearchkey, string MerchantID)
        {
            DynamicLambda <Shops> bulider            = new DynamicLambda <Shops>();
            Expression <Func <Shops, Boolean> > expr = null;

            //如果商户号不为空,则优先搜索商户号
            if (!string.IsNullOrWhiteSpace(MerchantID))
            {
                int intMerchantID = 0;
                try
                {
                    if (MerchantID.Length >= 6 && MerchantID.StartsWith("61"))
                    {
                        MerchantID = MerchantID.Trim().Substring(2, 4);

                        intMerchantID = Convert.ToInt32(MerchantID.Trim());
                    }
                }
                catch
                {
                }

                Expression <Func <Shops, Boolean> > temp = t => t.ID == intMerchantID;
                expr = bulider.BuildQueryAnd(expr, temp);
            }
            else
            {
                Expression <Func <Shops, Boolean> > tmpStoreID = t => t.ShopName.Contains(strSearchkey) ||
                                                                 t.Province.Contains(strSearchkey) ||
                                                                 t.City.Contains(strSearchkey) ||
                                                                 t.County.Contains(strSearchkey)
                                                                 //|| t.Users.UserName.Contains(strSearchkey)
                                                                 //|| t.Users.Phone.Contains(strSearchkey)
                                                                 //|| t.Users2.RealName.Contains(strSearchkey)
                                                                 || t.Remark.Contains(strSearchkey);
                expr = bulider.BuildQueryAnd(expr, tmpStoreID);
            }
            return(expr);
        }
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <INFOR_CATEGORIES, Boolean> > BuildSearchCriteria(string id)
        {
            DynamicLambda <INFOR_CATEGORIES> bulider            = new DynamicLambda <INFOR_CATEGORIES>();
            Expression <Func <INFOR_CATEGORIES, Boolean> > expr = null;

            if (!string.IsNullOrEmpty(Request["InforCategoryName"]))
            {
                var data = Request["InforCategoryName"].Trim();
                Expression <Func <INFOR_CATEGORIES, Boolean> > tmp = t => t.InforCategoryName.Contains(data);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            if (Request["Enabled"] == "0" || Request["Enabled"] == "1")
            {
                var data = Request["Enabled"] == "1" ? 1 : 0;
                Expression <Func <INFOR_CATEGORIES, Boolean> > tmp = t => t.Status == data;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            Expression <Func <INFOR_CATEGORIES, Boolean> > tmpSolid = t => t.ParentID == id;

            expr = bulider.BuildQueryAnd(expr, tmpSolid);
            return(expr);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 创建查询条件表达式和排序表达式
        /// </summary>
        /// <param name="orderingSelector"></param>
        /// <returns></returns>
        private Expression<Func<sys_Member, bool>> BuildPredicate(out dynamic orderingSelector)
        {
            ParameterExpression parameter = Expression.Parameter(typeof(sys_Member));

            // 排序表达式
            orderingSelector = Expression.Lambda(Expression.Property(parameter, Grid3.SortField), parameter);

            DynamicLambda<sys_Member> bulider = new DynamicLambda<sys_Member>();
            Expression<Func<sys_Member, Boolean>> expr = null;

            Expression<Func<sys_Member, Boolean>> tmp = t => t.IsDelete == false;
            expr = bulider.BuildQueryAnd(expr, tmp);

            Expression<Func<sys_Member, Boolean>> tmp0 = t => t.IsUsing == true;
            expr = bulider.BuildQueryAnd(expr, tmp0);

            //查询角色中用户
            if (Grid1.SelectedRowIndex >= 0)
            {
                int rid = Convert.ToInt32(Grid1.DataKeys[Grid1.SelectedRowIndex][0]);
                sys_Role role = RoleService.FirstOrDefault(r => r.Id == rid);
                List<int> useridlist = new List<int>();
                foreach (sys_Member m in role.sys_Member)
                {
                    useridlist.Add(m.id);
                }
                Expression<Func<sys_Member, Boolean>> tmpSolid = t => useridlist.Contains(t.id);
                expr = bulider.BuildQueryAnd(expr, tmpSolid);
            }
            return expr;
        }
        /// <summary>
        /// 创建查询条件表达式和排序表达式
        /// </summary>
        /// <param name="orderingSelector"></param>
        /// <returns></returns>
        private Expression<Func<sys_Member, bool>> BuildPredicate(out dynamic orderingSelector)
        {
            // 查询条件表达式
            DynamicLambda<sys_Member> bulider = new DynamicLambda<sys_Member>();
            Expression<Func<sys_Member, Boolean>> expr = null;

            if (Role != null)
            {
                List<sys_Member> userlist = Role.sys_Member.ToList();
                List<int> uid = new List<int>();
                userlist.ForEach(i => uid.Add(i.id));
                Expression<Func<sys_Member, Boolean>> tmp = t => !uid.Contains(t.id);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            //未删除用户
            Expression<Func<sys_Member, Boolean>> tmp5 = t => t.IsDelete == false;
            expr = bulider.BuildQueryAnd(expr, tmp5);
            //未禁用用户
            Expression<Func<sys_Member, Boolean>> tmp6 = t => t.IsUsing == true;
            expr = bulider.BuildQueryAnd(expr, tmp6);

            if (!string.IsNullOrWhiteSpace(ttbSearch.Text))
            {
                Expression<Func<sys_Member, Boolean>> tmp2 = t => t.UserName.Contains(ttbSearch.Text.Trim());
                expr = bulider.BuildQueryAnd(expr, tmp2);

                Expression<Func<sys_Member, Boolean>> tmp3 = t => t.RealName.Contains(ttbSearch.Text.Trim());
                expr = bulider.BuildQueryOr(expr, tmp3);

                Expression<Func<sys_Member, Boolean>> tmp4 = t => t.Email.Contains(ttbSearch.Text.Trim());
                expr = bulider.BuildQueryOr(expr, tmp4);
            }

            if (SelectOid != 0)
            {
                List<int> oidList = GetAllChildOrgnizationId(SelectOid);
                Expression<Func<sys_Member, Boolean>> tmp = t => oidList.Contains(t.sys_Orgnization_Id);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }



            ParameterExpression parameter = Expression.Parameter(typeof(sys_Member));

            // 排序表达式
            orderingSelector = Expression.Lambda(Expression.Property(parameter, Grid1.SortField), parameter);

            return expr;
        }
Exemplo n.º 29
0
        /// <summary>
        /// 创建查询条件表达式和排序表达式
        /// </summary>
        /// <param name="orderingSelector"></param>
        /// <returns></returns>
        private Expression<Func<sys_LoginLog, bool>> BuildPredicate(out dynamic orderingSelector)
        {
            DynamicLambda<sys_LoginLog> bulider = new DynamicLambda<sys_LoginLog>();
            Expression<Func<sys_LoginLog, Boolean>> expr = null;

            Expression<Func<sys_LoginLog, Boolean>> tmp = t => BaseOperResUidList.Contains(t.Uid);
            expr = bulider.BuildQueryAnd(expr, tmp);

            if (BASEttb != null && !string.IsNullOrWhiteSpace(BASEttb.Text))
            {
                Expression<Func<sys_LoginLog, Boolean>> tmp1 = t => t.RealName.Contains(BASEttb.Text);
                expr = bulider.BuildQueryAnd(expr, tmp1);
            }

            ParameterExpression parameter = Expression.Parameter(typeof(sys_LoginLog));
            orderingSelector = Expression.Lambda(Expression.Property(parameter, Grid1.SortField), parameter);


            return expr;
        }
Exemplo n.º 30
0
        /// <summary>
        /// 构建查询表达式
        /// </summary>
        /// <returns></returns>
        private Expression <Func <Role, Boolean> > BuildSearchCriteria(RoleSearchModel searchModel)
        {
            DynamicLambda <Role> bulider            = new DynamicLambda <Role>();
            Expression <Func <Role, Boolean> > expr = null;

            if (CurrentInfo.IsShopAdmin)
            {
                Expression <Func <Role, Boolean> > tmpStoreID = t => t.ShopsID == CurrentInfo.CurrentShop.ID;
                expr = bulider.BuildQueryAnd(expr, tmpStoreID);
            }
            else
            {
                Expression <Func <Role, Boolean> > tmpStoreID = t => t.StoreID == CurrentInfo.CurrentStore.ID;
                expr = bulider.BuildQueryAnd(expr, tmpStoreID);
            }

            if (!string.IsNullOrWhiteSpace(searchModel.RoleName))
            {
                Expression <Func <Role, Boolean> > tmp = t => t.Name.Contains(searchModel.RoleName);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            if (!string.IsNullOrWhiteSpace(searchModel.Disabled))
            {
                var flage = searchModel.Disabled == "1" ? true : false;
                Expression <Func <Role, Boolean> > tmp = t => t.Disabled == flage;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            if (!string.IsNullOrWhiteSpace(searchModel.startDate))
            {
                try
                {
                    DateTime dt = Convert.ToDateTime(searchModel.startDate);
                    Expression <Func <Role, Boolean> > tmp = t => t.CreateTime >= dt;
                    expr = bulider.BuildQueryAnd(expr, tmp);
                }
                catch
                {
                }
            }

            if (!string.IsNullOrWhiteSpace(searchModel.endDate))
            {
                try
                {
                    DateTime dt = Convert.ToDateTime(searchModel.endDate).AddDays(1);
                    Expression <Func <Role, Boolean> > tmp = t => t.CreateTime < dt;
                    expr = bulider.BuildQueryAnd(expr, tmp);
                }
                catch
                {
                }
            }

            //Expression<Func<Role, Boolean>> tmpSolid = t => t.IsDeleted == false;
            //expr = bulider.BuildQueryAnd(expr, tmpSolid);
            //如果不是管理员账号则 把“店长”这个角色隐藏掉,防止其他客户修改
            if (!CurrentInfo.IsAdministrator)
            {
                Expression <Func <Role, Boolean> > tmpAdmin = t => t.ID != 42;
                expr = bulider.BuildQueryAnd(expr, tmpAdmin);
            }

            return(expr);
        }
        /// <summary>
        /// 创建查询条件表达式和排序表达式
        /// </summary>
        /// <param name="orderingSelector"></param>
        /// <returns></returns>
        private Expression<Func<sys_ForbidIp, bool>> BuildPredicate(out dynamic orderingSelector)
        {
            DynamicLambda<sys_ForbidIp> bulider = new DynamicLambda<sys_ForbidIp>();
            Expression<Func<sys_ForbidIp, Boolean>> expr = null;

            Expression<Func<sys_ForbidIp, Boolean>> tmp1 = t => t.IsDelete == false;
            expr = bulider.BuildQueryAnd(expr, tmp1);

            if (ttb != null && !string.IsNullOrWhiteSpace(ttb.Text))
            {
                Expression<Func<sys_ForbidIp, Boolean>> tmp2 = t => t.IP.Contains(ttb.Text.Trim());
                expr = bulider.BuildQueryAnd(expr, tmp2);                 
            }


            // 排序表达式
            ParameterExpression parameter = Expression.Parameter(typeof(sys_ForbidIp));
            orderingSelector = Expression.Lambda(Expression.Property(parameter, Grid1.SortField), parameter);

            return expr;
        }
Exemplo n.º 32
0
        /// <summary>
        /// 创建查询条件表达式和排序表达式
        /// </summary>
        /// <param name="orderingSelector"></param>
        /// <returns></returns>
        private Expression<Func<sys_Member, bool>> BuildPredicate(out dynamic orderingSelector)
        {
            DynamicLambda<sys_Member> bulider = new DynamicLambda<sys_Member>();
            Expression<Func<sys_Member, Boolean>> expr = null;

            Expression<Func<sys_Member, Boolean>> tmp1 = t => t.IsDelete == false;
            expr = bulider.BuildQueryAnd(expr, tmp1);

            if (BASEttb != null && !string.IsNullOrWhiteSpace(BASEttb.Text))
            {
                Expression<Func<sys_Member, Boolean>> tmp2 = t => t.UserName.Contains(BASEttb.Text.Trim());
                expr = bulider.BuildQueryAnd(expr, tmp2);

                Expression<Func<sys_Member, Boolean>> tmp3 = t => t.RealName.Contains(BASEttb.Text.Trim());
                expr = bulider.BuildQueryOr(expr, tmp3);

                Expression<Func<sys_Member, Boolean>> tmp4 = t => t.Email.Contains(BASEttb.Text.Trim());
                expr = bulider.BuildQueryOr(expr, tmp4);
            }

            if (SelectOid != 0)
            {
                List<int> oidList = GetAllChildOrgnizationId(SelectOid);
                Expression<Func<sys_Member, Boolean>> tmp = t => oidList.Contains(t.sys_Orgnization_Id);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            // 排序表达式
            ParameterExpression parameter = Expression.Parameter(typeof(sys_Member));
            orderingSelector = Expression.Lambda(Expression.Property(parameter, Grid1.SortField), parameter);

            return expr;
        }
Exemplo n.º 33
0
        /// <summary>
        /// 获取商家下的门店
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="username"></param>
        /// <param name="pageNumber"></param>
        /// <returns></returns>
        public ActionResult GetShopStores(int pageSize, string username, int pageNumber)
        {
            SearchModel <StoresParams> searchModel = new SearchModel <StoresParams>
            {
                PageIndex = pageNumber,
                PageSize  = pageSize,
                Model     = new StoresParams()
                {
                    StoreName = username
                }
            };

            //IShopsService shopsService = ServiceFactory.Create<IShopsService>();
            //var shop = shopsService.GetFirstOrDefault(t => t.AdminUserID == CurrentInfo.CurrentUser.ID);


            DynamicLambda <Stores> bulider            = new DynamicLambda <Stores>();
            Expression <Func <Stores, Boolean> > expr = null;

            //如果是店铺管理员
            if (CurrentInfo.IsShopAdmin)
            {
                Expression <Func <Stores, Boolean> > tmp = t => t.ShopId == CurrentInfo.CurrentUser.ShopsID && t.Disabled != true;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            else
            {
                Expression <Func <Stores, Boolean> > tmp = t => t.ID == CurrentInfo.CurrentStore.ID;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            ////如果是商家本人的账号,则显示商家自己的门店
            //if (shop != null)
            //{
            //    Expression<Func<Stores, Boolean>> tmp = t => t.ShopId == shop.ID;
            //    expr = bulider.BuildQueryAnd(expr, tmp);
            //}

            if (!string.IsNullOrWhiteSpace(username))
            {
                username = username.Trim();
                Expression <Func <Stores, Boolean> > tmp = t => t.StoreName.Contains(username);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            IStoresService storesService = ServiceFactory.Create <IStoresService>();

            int total;
            var data = storesService.GetEntitiesByPage(searchModel.PageIndex, searchModel.PageSize, out total, expr, false, t => t.ID).Select(t => new
            {
                ID           = t.ID,
                ShopsName    = t.Shops.ShopName,
                StoreName    = t.StoreName,
                Adress       = t.Adress,
                Phone        = t.Phone,
                IsShowWeiXin = t.IsShowWeiXin == true ? "显示" : "不显示",
                IsMainStore  = t.IsMainStore,
                Disabled     = t.Disabled,
                AdminUserID  = t.AdminUserID,
                ///  AdminName = t.AdminUserID==null?"0":t.AdminUserID.ToString() //t.Users1 != null ? t.Users1.RealName : ""
            }).ToList();

            return(Json(new { total = total, rows = data }, JsonRequestBehavior.AllowGet));
        }