Ejemplo n.º 1
0
        public static List <M_Users> GetUsers(int pageSize, int pageIndex, ref int totalCount, ref int pageCount, int type = -1, int status = -1, string keyWords = "", string colmonasc = "", bool isasc = false)
        {
            string whereSql = " a.Status<>9";

            if (type > -1)
            {
                whereSql += " and a.type=" + type + " ";
            }
            if (status > -1)
            {
                whereSql += " and a.Status=" + status;
            }
            if (!string.IsNullOrEmpty(keyWords))
            {
                whereSql += " and (a.UserName like '%" + keyWords + "%' or a.LoginName like'%" + keyWords + "%') ";
            }
            string         cstr = @" a.* ";
            DataTable      dt   = CommonBusiness.GetPagerData("M_Users a  ", cstr, whereSql, "a.AutoID", colmonasc, pageSize, pageIndex, out totalCount, out pageCount, isasc);
            List <M_Users> list = new List <M_Users>();
            M_Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }
                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 2
0
        public static List <M_Users> GetUsers(int pageSize, int pageIndex, ref int totalCount, ref int pageCount, int type = 2, int status = -1, string keyWords = "", string colmonasc = "", bool isasc = false)
        {
            string whereSql = " a.isfreeze<>9";

            if (type > -1)
            {
                whereSql += " and a.admingid=" + type + " ";
            }
            if (status > -1)
            {
                whereSql += " and a.isfreeze=" + status;
            }
            if (!string.IsNullOrEmpty(keyWords))
            {
                whereSql += " and (a.UserName like '%" + keyWords + "%' or a.mobile like'%" + keyWords + "%' or a.email like'%" + keyWords + "%') ";
            }
            string         cstr = @" a.*,convert(varchar(25),b.registertime,120) registertime,convert(varchar(25),b.lastvisittime,120) lastvisittime ";
            DataTable      dt   = CommonBusiness.GetPagerData("Owzx_Users a join owzx_userdetails b on a.uid=b.uid  ", cstr, whereSql, "a.Uid", colmonasc, pageSize, pageIndex, out totalCount, out pageCount, isasc);
            List <M_Users> list = new List <M_Users>();
            M_Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }
                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 3
0
        public static List <M_Users> GetUsers(string keyWords, string roleID, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            string whereSql = " Status<>9";

            if (!string.IsNullOrEmpty(keyWords))
            {
                whereSql += " and ( Name like '%" + keyWords + "%' or MobilePhone like '%" + keyWords + "%' or Email like '%" + keyWords + "%')";
            }


            if (!string.IsNullOrEmpty(roleID))
            {
                whereSql += " and RoleID='" + roleID + "'";
            }

            DataTable      dt   = CommonBusiness.GetPagerData("M_Users", "*", whereSql, "AutoID", pageSize, pageIndex, out totalCount, out pageCount);
            List <M_Users> list = new List <M_Users>();
            M_Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);

                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }

                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 4
0
        public static List <M_Users> GetUsers(int sex, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string address = "", string age = "", int sourcetype = 0, int status = -1, string keyWords = "")
        {
            string whereSql = " a.Status<>9";

            if (sex > -1)
            {
                whereSql += " and a.Sex=" + sex;
            }
            if (status > -1)
            {
                whereSql += " and a.Status=" + status;
            }
            if (!string.IsNullOrEmpty(keyWords))
            {
                whereSql += " and (a.Name like '%" + keyWords + "%' or a.LoginName like'%" + keyWords + "%') ";
            }
            if (sourcetype > -1)
            {
                whereSql += " and a.sourcetype=" + sourcetype;
            }
            if (!string.IsNullOrEmpty(address))
            {
                string[] strArr = address.Split(',');
                for (int i = 0; i < strArr.Length; i++)
                {
                    whereSql += (i == 0
                        ? " and a. province='"
                        : i == 1 ? " and a.City='" : i == 2 ? " and a.District='" : "") + strArr[i] + "'";
                }
            }

            if (!string.IsNullOrEmpty(age))
            {
                string[] strArr = age.Split('~');
                for (int i = 0; i < strArr.Length; i++)
                {
                    whereSql += (i == 0? " and a.Age>=": " and a.Age<=") + strArr[i];
                }
            }
            string         cstr = @"a.AuthorBTime,a.AuthorETime,a.AuthorType,a.userID,a.Avatar,a.Name,a.LoginName,a.Age,a.MyService,a.Province,a.City,a.District,a.CreateTime,a.Status,a.Sex,a.IsMarry,a.Education,a.ROleID,
a.BHeight,a.Levelid,a.BWeight,a.MyContent,a.MyCharacter,a.BPay,a.Account,a.TalkTo,a.Description";
            DataTable      dt   = CommonBusiness.GetPagerData("M_Users a", cstr, whereSql, "a.AutoID", pageSize, pageIndex, out totalCount, out pageCount);
            List <M_Users> list = new List <M_Users>();
            M_Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }
                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 5
0
        public static List <M_Users> GetUsers(int pageSize, int pageIndex, ref int totalCount, ref int pageCount, int type = -1, int status = -1, int sourcetype = -1, string keyWords = "", string colmonasc = "", bool isasc = false,
                                              string rebatemin = "", string rebatemax = "", string accountmin = "", string accountmax = "")
        {
            string whereSql = " a.Status<>9 and isadmin=0 ";

            if (!string.IsNullOrEmpty(rebatemax))
            {
                whereSql += " and a.Rebate<='" + rebatemax + "' ";
            }
            if (!string.IsNullOrEmpty(rebatemin))
            {
                whereSql += " and a.Rebate>'" + rebatemin + "' ";
            }
            if (sourcetype > -1)
            {
                whereSql += " and a.sourcetype=" + sourcetype + " ";
            }
            if (type > -1)
            {
                whereSql += " and a.type=" + type + " ";
            }
            if (!string.IsNullOrEmpty(accountmax))
            {
                whereSql += " and b.AccountFee<='" + accountmax + "' ";
            }
            if (!string.IsNullOrEmpty(accountmin))
            {
                whereSql += " and b.AccountFee>'" + accountmin + "' ";
            }
            if (status > -1)
            {
                whereSql += " and a.Status=" + status;
            }
            if (!string.IsNullOrEmpty(keyWords))
            {
                whereSql += " and (a.UserName like '%" + keyWords + "%' or a.LoginName like'%" + keyWords + "%') ";
            }
            string         cstr = @" a.*,b.AccountFee ";
            DataTable      dt   = CommonBusiness.GetPagerData("M_Users a left join UserAccount b on a.UserID=b.UserID ", cstr, whereSql, "a.AutoID", colmonasc, pageSize, pageIndex, out totalCount, out pageCount, isasc);
            List <M_Users> list = new List <M_Users>();
            M_Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }
                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 根据账号密码获取信息(登录)
        /// </summary>
        /// <param name="loginname"></param>
        /// <param name="pwd"></param>
        /// <param name="operateip"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static M_Users GetM_UserByProUserName(string loginname, string pwd, string operateip, out int result, EnumUserOperateType type = EnumUserOperateType.Login, int sourceType = 0)
        {
            pwd = ProBusiness.Encrypt.GetEncryptPwd(pwd, loginname);
            DataSet ds    = new M_UsersDAL().GetM_UserByProUserName(loginname, pwd, sourceType, out result);
            M_Users model = null;

            if (ds.Tables.Contains("M_User") && ds.Tables["M_User"].Rows.Count > 0)
            {
                model = new M_Users();
                model.FillData(ds.Tables["M_User"].Rows[0]);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }
                //权限
                if (model.Role != null && model.Role.IsDefault == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else if (model.IsAdmin == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else
                {
                    model.Menus = new List <Menu>();
                    foreach (DataRow dr in ds.Tables["Permission"].Rows)
                    {
                        Menu menu = new Menu();
                        menu.FillData(dr);
                        model.Menus.Add(menu);
                    }
                }
            }
            if (model != null && model.Status == 1)
            {
                LogBusiness.AddLoginLog(loginname, operateip, model != null ? model.UserID : "", type);
                LogBusiness.UpdateLastIP(model != null ? model.UserID : "", operateip);
            }
            return(model);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 根据账号密码获取信息(登录)
        /// </summary>
        /// <param name="loginname"></param>
        /// <param name="pwd"></param>
        /// <param name="operateip"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static M_Users GetM_UserByProUserName(string loginname, string pwd, string operateip, out int result)
        {
            pwd = CloudSalesTool.Encrypt.GetEncryptPwd(pwd, loginname);
            DataSet ds    = new M_UsersDAL().GetM_UserByProUserName(loginname, pwd, out result);
            M_Users model = null;

            if (ds.Tables.Contains("M_User") && ds.Tables["M_User"].Rows.Count > 0)
            {
                model = new M_Users();
                model.FillData(ds.Tables["M_User"].Rows[0]);
                if (!string.IsNullOrEmpty(model.RoleID))
                {
                    model.Role = ManageSystemBusiness.GetRoleByIDCache(model.RoleID);
                }
                //权限
                if (model.Role != null && model.Role.IsDefault == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else if (model.IsAdmin == 1)
                {
                    model.Menus = CommonBusiness.ManageMenus;
                }
                else
                {
                    model.Menus = new List <Menu>();
                    foreach (DataRow dr in ds.Tables["Permission"].Rows)
                    {
                        Menu menu = new Menu();
                        menu.FillData(dr);
                        model.Menus.Add(menu);
                    }
                }
            }
            //记录登录日志
            LogBusiness.AddLoginLog(loginname, model != null, IntFactoryEnum.EnumSystemType.Manage, operateip, "", "");

            return(model);
        }