public static List <UserImgs> GetUserImgList(string keywords, int status, string begintime, string endtime, int pageIndex, int pageSize, ref int totalCount, ref int pageCount) { string whereSql = " a.Status<>9 "; if (status > -1) { whereSql += " and a.status=" + status; } if (!string.IsNullOrEmpty(begintime)) { whereSql += " and a.CreateTime>='" + begintime + " 00:00:00'"; } if (!string.IsNullOrEmpty(endtime)) { whereSql += " and a.CreateTime<'" + endtime + " 23:59:59:999'"; } if (!string.IsNullOrEmpty(keywords)) { whereSql += " and b.Name like '%" + keywords + "%' "; } string clumstr = "a.*,b.Name as UserName "; DataTable dt = CommonBusiness.GetPagerData("UserImgs a left join M_Users b on a.Userid=b.Userid ", clumstr, whereSql, "a.AutoID", pageSize, pageIndex, out totalCount, out pageCount); List <UserImgs> list = new List <UserImgs>(); foreach (DataRow item in dt.Rows) { UserImgs model = new UserImgs(); model.FillData(item); list.Add(model); } return(list); }
public static List <UserImgs> GetUserImgList(string userid, int status, int pageIndex, int pageSize, ref int totalCount, ref int pageCount) { string whereSql = " a.Status<>9 "; if (status > -1) { whereSql += " and a.status=" + status; } if (!string.IsNullOrEmpty(userid)) { whereSql += " and a.UserID='" + userid + "' "; } string clumstr = "a.*,b.Name as UserName "; DataTable dt = CommonBusiness.GetPagerData("UserImgs a left join M_Users b on a.Userid=b.Userid ", clumstr, whereSql, "a.AutoID", pageSize, pageIndex, out totalCount, out pageCount); List <UserImgs> list = new List <UserImgs>(); foreach (DataRow item in dt.Rows) { UserImgs model = new UserImgs(); model.FillData(item); list.Add(model); } return(list); }
public static List <UserImgs> GetNewImg(int tops, int status) { DataTable dt = UserImgsDAL.BaseProvider.GetNewImg(tops, status); List <UserImgs> list = new List <UserImgs>(); foreach (DataRow item in dt.Rows) { UserImgs model = new UserImgs(); model.FillData(item); list.Add(model); } return(list); }
public JsonResult UserImgUpload(string id, string name, string type, string lastModifiedDate, int size, HttpPostedFileBase file) { string pic = "", error = ""; if (CurrentUser == null) { error = "请登录后在操作"; } else { if (file != null) { if (ValidateImg(name)) { try { pic = SaveImg(file, name, "UserAvatar/"); UserImgs imgs = new UserImgs() { GoodCount = 0, Size = size, UserID = CurrentUser.UserID, ImgUrl = pic }; UserImgsBusiness.Create(imgs, OperateIP); } catch (Exception ex) { error = ex.Message; } } else { error = "图片格式不正确"; } } else { error = "暂未获取到图片信息"; } } JsonDictionary.Add("msgError", error); JsonDictionary.Add("imgUrl", pic); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public static bool Create(UserImgs userimg, string operateip) { var result = UserImgsDAL.BaseProvider.Create(userimg.UserID, userimg.ImgUrl, userimg.Size); return(result); }