Пример #1
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);
        }
Пример #2
0
        public static List <FeedBack> GetFeedBacks(string keywords, string beginDate, string endDate, int type, int status, string userID, int pageSize, int pageIndex, out int totalCount, out int pageCount)
        {
            string sqlWhere = "1=1";

            if (type != -1)
            {
                sqlWhere += " and type=" + type;
            }

            if (status != -1)
            {
                sqlWhere += " and status=" + status;
            }
            if (!string.IsNullOrEmpty(keywords))
            {
                sqlWhere += " and Reamrk like '%" + keywords + "%' ";
            }
            if (status > -1)
            {
                sqlWhere += " and status=" + status;
            }
            if (!string.IsNullOrEmpty(userID))
            {
                sqlWhere += " and CreateUserID='" + userID + "'";
            }

            if (!string.IsNullOrEmpty(beginDate))
            {
                sqlWhere += " and createtime>='" + beginDate + "'";
            }

            if (!string.IsNullOrEmpty(endDate))
            {
                sqlWhere += " and createtime<='" + DateTime.Parse(endDate).AddDays(1).ToString("yyyy-MM-dd") + "'";
            }

            DataTable dt = CommonBusiness.GetPagerData("FeedBack", "*", sqlWhere, "AutoID", pageSize, pageIndex, out totalCount, out pageCount);

            List <FeedBack> list = new List <FeedBack>();
            FeedBack        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new FeedBack();
                model.FillData(item);
                list.Add(model);
            }

            return(list);
        }
Пример #3
0
        public static List <M_Users> GetUsersReCommen(int sex, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string address = "", string age = "", string cdesc = "")
        {
            string whereSql = " a.Status<>9";

            if (sex > -1)
            {
                whereSql += " and a.Sex=" + sex;
            }

            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 clumstr = "a.AuthorBTime,a.AuthorETime,a.AuthorType,a.userID,a.Avatar,a.Name,a.Age,a.LoginName,a.MyService,a.Province,a.City,a.District,a.CreateTime,a.Status,a.Sex,a.IsMarry,a.Education," +
                             "a.BHeight,a.Levelid,a.BWeight,a.MyContent,a.MyCharacter,a.TalkTo,a.BPay,a.Account,b.ImgCount,b.IsLogin,b.RecommendCount,b.SeeCount";
            DataTable      dt   = CommonBusiness.GetPagerData("M_Users a left join userReport b on a.Userid=b.Userid ", clumstr, whereSql, "a.AutoID" + (string.IsNullOrEmpty(cdesc) ? "" : "," + cdesc), 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);
                list.Add(model);
            }

            return(list);
        }