public ActionResult Item_db_image() { BLL.DB_Image dal = new BLL.DB_Image(); string pagenum = this.Request.Form["pagenum"]; string numPerPage = this.Request.Form["numPerPage"]; string dbimagetype = this.Request.Form["dbimagetype"]; string dbimagedate = this.Request.Form["dbimagedate"]; string dbimagename = this.Request.Form["dbimagename"]; string where = "", order = "Image_addtime desc"; if (string.IsNullOrEmpty(numPerPage)) { numPerPage = "20"; } if (string.IsNullOrEmpty(pagenum)) { pagenum = "1"; } int _dbimagetype = 0; int.TryParse(dbimagetype, out _dbimagetype); where += " 1=1 "; if (_dbimagetype > 0) { where += string.Format(" and Image_Category_ID={0} ", _dbimagetype); } if (_dbimagetype == -1) { where += string.Format(" and Image_Category_ID>{0} ", 0); } if (!string.IsNullOrEmpty(dbimagedate)) { where += string.Format(" and ( CONVERT(varchar(100), Image_addtime, 23)=''{0}'' )", dbimagedate); } if (!string.IsNullOrEmpty(dbimagename)) { where += string.Format(" and Image_name like ''%{0}%''", dbimagename); } string _where = Server.UrlDecode(this.Request.QueryString["nwhere"] + ""); bool HasOneEqOne = !((_where + "").Trim().Length <= 3); bool IsOneEqOne = ((where + "").Trim().Length <= 3); if (IsOneEqOne && !string.IsNullOrEmpty(_where) && HasOneEqOne) { _where = this.Server.UrlDecode(_where); where = _where; } else { _where = where; } NModel.PageData <NModel.DB_Image> PD = new NModel.PageData <NModel.DB_Image>() { NumPerPage = numPerPage, PageNum = pagenum, TotalPage = dal.GetWhereListTotal(where), Where = where, OrderField = order }; dal.Close(); return(View(PD)); }
public ActionResult Item_db_img_dialog() { BLL.DB_Image dal = new BLL.DB_Image(); string pagenum = this.Request.Form["pagenum"]; string numPerPage = this.Request.Form["numPerPage"]; string dbimagetype = this.Request.Form["dbimagetype"]; string dbimagedate = this.Request.Form["dbimagedate"]; string dbimagename = this.Request.Form["dbimagename"]; string db_image_type = this.Request.QueryString["db_image_type"]; string selectid = this.Request.QueryString["selectid"]; if (!string.IsNullOrEmpty(selectid)) { dbimagetype = selectid; } if (!string.IsNullOrEmpty(db_image_type)) { dbimagetype = db_image_type; } string where = "", order = "Image_addtime desc"; if (string.IsNullOrEmpty(numPerPage)) { numPerPage = "20"; } if (string.IsNullOrEmpty(pagenum)) { pagenum = "1"; } int _dbimagetype = 0; int.TryParse(dbimagetype, out _dbimagetype); where += " 1=1 "; if (_dbimagetype > 0) { where += string.Format(" and Image_Category_ID={0} ", _dbimagetype); } if (!string.IsNullOrEmpty(dbimagedate)) { where += string.Format(" and ( CONVERT(varchar(100), Image_addtime, 23)=''{0}'' )", dbimagedate); } if (!string.IsNullOrEmpty(dbimagename)) { where += string.Format(" and Image_name like ''%{0}%''", dbimagename); } NModel.PageData <NModel.DB_Image> PD = new NModel.PageData <NModel.DB_Image>() { NumPerPage = numPerPage, PageNum = pagenum, TotalPage = dal.GetWhereListTotal(where), Where = where, OrderField = order }; dal.Close(); return(View(PD)); }