示例#1
0
        public static List <UserNeeds> FindNeedsRated(int type, string userId, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            string sqlwhere = "  a.Status not in (6,9)";

            if (!string.IsNullOrEmpty(userId))
            {
                sqlwhere += " and a.UserID='" + userId + "'";
            }
            if (type > -1)
            {
                sqlwhere += " and a.Type in(" + type + ")";
            }
            DataTable dt = CommonBusiness.GetPagerData(" UserNeeds a left join m_users b  on a.UserID=b.UserID left join m_users c on a.InviteID=c.UserID ",
                                                       "a.AutoID,a.NeedDate,a.NeedCity,a.Type,a.UserID,a.UserName,a.Status,a.Title,a.LetDays,a.InviteName,a.NeedSex,a.NeedType,a.CreateTime,b.province,b.Avatar as UserAvatar ,c.Avatar as InviteAvatar", sqlwhere, "a.AutoID ", pageSize, pageIndex,
                                                       out totalCount, out pageCount);
            List <UserNeeds> list = new List <UserNeeds>();

            foreach (DataRow dr in dt.Rows)
            {
                UserNeeds model = new UserNeeds();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }
示例#2
0
        public static List <UserNeeds> FindNeedsList(string keyWords, string type, string userId, string status, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string begintime = "", string endtime = "", int needSex = -1, string age = "", string address = "")
        {
            string sqlwhere = "  a.Status <>9";

            if (!string.IsNullOrEmpty(userId))
            {
                sqlwhere += " and a.UserID='" + userId + "'";
            }
            if (type != "-1" && !string.IsNullOrEmpty(type))
            {
                sqlwhere += " and a.Type in (" + type + ")";
            }
            if (!string.IsNullOrEmpty(keyWords))
            {
                sqlwhere += " and a.Content like '%" + keyWords + "%' ";
            }
            if (needSex > -1)
            {
                sqlwhere += " and a.needSex=" + needSex;
            }
            if (!string.IsNullOrEmpty(status))
            {
                sqlwhere += " and a.status in(" + status + ") ";
            }
            if (!string.IsNullOrEmpty(begintime))
            {
                sqlwhere += " and a.CreateTime>='" + begintime + " 00:00:00'";
            }
            if (!string.IsNullOrEmpty(endtime))
            {
                sqlwhere += " and a.CreateTime<'" + endtime + " 23:59:59:999'";
            }
            if (!string.IsNullOrEmpty(address))
            {
                string[] strArr = address.Split(',');
                for (int i = 0; i < strArr.Length; i++)
                {
                    sqlwhere += (i == 0
                        ? " and b.province='"
                        : i == 1 ? " and b.City='" : i == 2 ? " and b.District='" : "") + strArr[i] + "'";
                }
            }
            DataTable dt = CommonBusiness.GetPagerData(" UserNeeds a left join m_users b  on a.UserID=b.UserID ",
                                                       "a.AutoID,a.NeedDate,a.NeedCity,a.UserID,a.Content,a.Status,a.Type,a.UserName,a.Title,a.LetDays,a.InviteName,a.NeedSex,a.NeedType,a.CreateTime,b.province,b.Avatar as UserAvatar", sqlwhere, "a.AutoID ", pageSize, pageIndex,
                                                       out totalCount, out pageCount);
            List <UserNeeds> list = new List <UserNeeds>();

            foreach (DataRow dr in dt.Rows)
            {
                UserNeeds model = new UserNeeds();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="autoId"></param>
        /// <returns></returns>
        public static UserNeeds FindNeedsDetail(int autoId)
        {
            UserNeeds model = new UserNeeds();
            DataTable dt    = UserNeedsDAL.BaseProvider.GetNeedsDetail(autoId);

            foreach (DataRow dr in dt.Rows)
            {
                model.FillData(dr);;
            }
            return(model);
        }
示例#4
0
        public static bool CreateNeeds(UserNeeds needs, string operateip)
        {
            var result = UserNeedsDAL.BaseProvider.CreateNeeds(needs.UserID, needs.UserName, needs.Type, needs.Title,
                                                               needs.Content, needs.LetDays, needs.ServiceConten, needs.NeedSex, needs.Price, needs.NeedType, needs.NeedCity, needs.NeedDate);

            if (result && needs.Type == 0)
            {
                LogBusiness.AddOperateLog(needs.UserID, needs.UserName, needs.UserLevelID, "", "", EnumUserOperateType.SendLog,
                                          needs.Title, operateip);
            }
            return(result);
        }
示例#5
0
        /// <summary>
        /// 保存需求
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public JsonResult SaveNeeds(string entity)
        {
            UserNeeds needs = JsonConvert.DeserializeObject <UserNeeds>(entity);

            needs.UserID      = CurrentUser.UserID;
            needs.UserName    = CurrentUser.Name;
            needs.UserLevelID = CurrentUser.Levelid;
            needs.Content     = needs.Content;
            JsonDictionary.Add("result", UserNeedsBusiness.CreateNeeds(needs, OperateIP));
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }