//得到网站内容列表 public static List <websitetypeinfo> getwebsite(pageinfo pdata) { List <websitetypeinfo> list = new List <websitetypeinfo>(); try { DataTable dt = pagehelper.getpagedt(pdata); if (dt != null) { foreach (DataRow dr in dt.Rows) { websitetypeinfo item = new websitetypeinfo(); item.wsid = TypeParse.DbObjToInt(dr["wsid"].ToString(), 0); item.wtid = TypeParse.DbObjToInt(dr["wtid"].ToString(), 0); item.websitetype = TypeParse.DbObjToString(dr["websitetype"].ToString(), ""); item.websitecontent = TypeParse.DbObjToString(dr["websitecontent"].ToString(), ""); list.Add(item); } } } catch (Exception ex) { throw new Exception(ex.Message); } finally { } return(list); }
/// <summary> /// 得到送货地址 /// </summary> /// <param name="pdata"></param> /// <returns></returns> public static List <addressinfo> getaddress(pageinfo pdata) { List <addressinfo> list = new List <addressinfo>(); try { DataTable dt = pagehelper.getpagedt(pdata); if (dt != null) { foreach (DataRow dr in dt.Rows) { addressinfo item = new addressinfo(); item.addressid = TypeParse.DbObjToInt(dr["addressid"].ToString(), 0); item.address = TypeParse.DbObjToString(dr["address"].ToString(), ""); item.contact = TypeParse.DbObjToString(dr["contact"].ToString(), ""); item.mobile = TypeParse.DbObjToString(dr["mobile"].ToString(), ""); item.tel = TypeParse.DbObjToString(dr["tel"].ToString(), ""); item.userid = TypeParse.DbObjToString(dr["userid"].ToString(), ""); item.deliveryIid = TypeParse.DbObjToInt(dr["deliveryIid"].ToString(), 0); item.deliveryIIid = TypeParse.DbObjToInt(dr["deliveryIIid"].ToString(), 0); item.isdefault = TypeParse.DbObjToInt(dr["isdefault"].ToString(), 0); list.Add(item); } } } catch (Exception ex) { throw new Exception(ex.Message); } finally { } return(list); }
/// <summary> /// 得到广告图片 /// </summary> /// <param name="pdata"></param> /// <returns></returns> public static List <webimagesinfo> getwebimages(pageinfo pdata) { List <webimagesinfo> webimageslist = new List <webimagesinfo>(); try { DataTable dt = pagehelper.getpagedt(pdata); if (dt != null) { foreach (DataRow dr in dt.Rows) { webimagesinfo item = new webimagesinfo(); item.wiid = TypeParse.DbObjToInt(dr["wiid"].ToString(), 0); item.imgurl = TypeParse.DbObjToString(dr["imgurl"].ToString(), ""); item.imginfo = TypeParse.DbObjToString(dr["imginfo"].ToString(), ""); item.imgname = TypeParse.DbObjToString(dr["imgname"].ToString(), "noimgs.jpg"); item.itid = TypeParse.DbObjToInt(dr["itid"].ToString(), 0); item.imagestype = TypeParse.DbObjToString(dr["imagestype"].ToString(), ""); item.imgcor = TypeParse.DbObjToString(dr["imgcor"].ToString(), ""); webimageslist.Add(item); } } } catch (Exception ex) { throw new Exception(ex.Message); } finally { } return(webimageslist); }
public static List <admininfo> getAdminListPage(pageinfo item) { List <admininfo> adminlist = new List <admininfo>(); try { DataTable dt = pagehelper.getpagedt(item); if (dt != null) { foreach (DataRow reader in dt.Rows) { admininfo data = new admininfo(); data.adminid = TypeParse.DbObjToInt(reader["adminid"], 0); data.adminname = TypeParse.DbObjToString(reader["adminname"], ""); data.adddate = TypeParse.DbObjToDateTime(reader["adddate"], DateTime.Now); data.updatedate = TypeParse.DbObjToDateTime(reader["updatedate"], DateTime.Now); adminlist.Add(data); } } return(adminlist); } catch (Exception E) { throw new Exception(E.Message); } finally { } }
/// <summary> /// 得到订单列表 /// </summary> /// <param name="pdata"></param> /// <returns></returns> public static List <orderinfo> getorderlist(pageinfo pdata) { List <orderinfo> list = new List <orderinfo>(); try { DataTable dt = pagehelper.getpagedt(pdata); if (dt != null) { foreach (DataRow dr in dt.Rows) { orderinfo item = new orderinfo(); item.orderid = TypeParse.DbObjToString(dr["orderid"].ToString(), "0"); item.tel = TypeParse.DbObjToString(dr["tel"].ToString(), ""); item.mobile = TypeParse.DbObjToString(dr["mobile"].ToString(), ""); item.address = TypeParse.DbObjToString(dr["address"].ToString(), ""); item.contact = TypeParse.DbObjToString(dr["contact"].ToString(), ""); item.allmoney = Decimal.Parse(TypeParse.DbObjToString(dr["allmoney"].ToString(), "0.00")); item.paymoney = Decimal.Parse(TypeParse.DbObjToString(dr["paymoney"].ToString(), "0.00")); item.orderstate = TypeParse.DbObjToInt(dr["orderstate"].ToString(), 0); item.orderdate = TypeParse.DbObjToDateTime(dr["orderdate"].ToString(), DateTime.Now); item.deliverydate = TypeParse.DbObjToDateTime(dr["deliverydate"].ToString(), DateTime.Now); item.ordernumber = TypeParse.DbObjToString(dr["ordernumber"].ToString(), ""); item.deliveryI = TypeParse.DbObjToString(dr["deliveryI"].ToString(), ""); item.deliveryII = TypeParse.DbObjToString(dr["deliveryII"].ToString(), ""); switch (item.orderstate) { case 0: item.orderstatestr = "进行中"; break; case 10: item.orderstatestr = "已完成"; break; case 44: item.orderstatestr = "待处理"; break; default: item.orderstatestr = "进行中"; break; } list.Add(item); } } } catch (Exception ex) { throw new Exception(ex.Message); } finally { } return(list); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { List <webimagesinfo> itlist = webimages.getimagestype(); itID.DataSource = itlist; itID.DataTextField = "imagestype"; itID.DataValueField = "itid"; itID.DataBind(); pageinfo pdata = new pageinfo(); int page; if (Request.QueryString["page"] != null) { page = TypeParse.DbObjToInt(Request.QueryString["page"].ToString(), 1); } else { page = 1; } pdata.curpageindex = page; pdata.pagesize = 10; pdata.where = "webimages.itid=imagestype.itid"; pdata.recordcount = webimages.getwebimagecount(); pdata.tablename = "webimages ,imagestype"; pdata.fieldlist = "webimages.wiid,webimages.imgurl,webimages.imginfo,webimages.itid,webimages.imgname,webimages.imgcor,imagestype.imagestype"; pdata.sorttype = 2; pdata.primarykey = "wiid"; pdata.totalpagecount = (pdata.recordcount % pdata.pagesize == 0 ? pdata.recordcount / pdata.pagesize : pdata.recordcount / pdata.pagesize + 1); if (pdata.totalpagecount == 0) { pdata.totalpagecount = 1; } List <webimagesinfo> imageslist = webimages.getwebimages(pdata); StringBuilder imgsb = new StringBuilder(); foreach (webimagesinfo item in imageslist) { string template = "<tr><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\" style=\"padding:5px 0;\"><img src=\"/Files/WebImages/{0}\" style=\"width:120px;height:100px;\"/></div></td><td height=\"20\" bgcolor=\"#FFFFFF\" style=\"padding:0 0 0 5px;\"><div align=\"left\">{1}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"left\" style=\"padding:0 0 0 5px;\">{2}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{3}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\"><a href=\"/Manager/EditWebImage.aspx/?wiid={4}\" style=\"color:blue;cursor:pointer;\">编辑</a> | <a href=\"javascript:delwebimages('{5}','{6}')\" style=\"color:blue;cursor:pointer;\">删除</a></div></td></tr>"; imgsb.AppendFormat(template, item.imgname, item.imgurl, item.imginfo, item.imagestype, item.wiid, item.wiid, pdata.curpageindex); } imageslistHTML = imgsb.ToString(); pageHTML = pagehelper.Pager(pdata.curpageindex, pdata.pagesize, pdata.recordcount, PageMode.Numeric, 5); } }
protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); List <websitetypeinfo> itlist = websitetype.getwebsitetype(); sb.Append("<select id=\"wtid\" name=\"wtid\" style=\"width:120px; border:solid 1px #cacaca; height:20px;\">"); foreach (websitetypeinfo item in itlist) { string template = "<option value=\"{0}\">{1}</option>"; sb.AppendFormat(template, item.wtid, item.websitetype); } sb.Append("</select>"); websitetypeHTML = sb.ToString(); int page = 1; if (Request.QueryString["page"] != null) { page = TypeParse.DbObjToInt(page, 1); } pageinfo pdata = new pageinfo(); pdata.curpageindex = page; pdata.pagesize = 10; pdata.where = "websitetype.wtid=website.wtid"; pdata.recordcount = websitetype.getwebsitecount(); pdata.tablename = "website ,websitetype"; pdata.fieldlist = "website.wsid,website.wtid,websitetype.websitetype,website.websitecontent"; pdata.sorttype = 2; pdata.primarykey = "wsid"; pdata.totalpagecount = (pdata.recordcount % pdata.pagesize == 0 ? pdata.recordcount / pdata.pagesize : pdata.recordcount / pdata.pagesize + 1); if (pdata.totalpagecount == 0) { pdata.totalpagecount = 1; } List <websitetypeinfo> websitelist = websitetype.getwebsite(pdata); StringBuilder imgsb = new StringBuilder(); foreach (websitetypeinfo item in websitelist) { string template = "<tr><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\" style=\"padding:5px 0;\">{0}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\" style=\"padding:0 0 0 5px;\"><div align=\"center\">{1}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\"><a href=\"/Manager/EditWebSite.aspx/?wsid={2}\" target=\"_blank\" style=\"color:blue;cursor:pointer;\">编辑</a> | <a href=\"javascript:delwebsite('{3}')\" style=\"color:blue;cursor:pointer;\">删除</a></div></td></tr>"; imgsb.AppendFormat(template, item.wsid, item.websitetype, item.wsid, item.wsid); } websitelistHTML = imgsb.ToString(); }
/// <summary> /// 得到产品 /// </summary> /// <param name="pdata"></param> /// <returns></returns> public static List <productinfo> getproduct(pageinfo pdata) { List <productinfo> list = new List <productinfo>(); try { DataTable dt = pagehelper.getpagedt(pdata); if (dt != null) { foreach (DataRow dr in dt.Rows) { productinfo item = new productinfo(); item.productid = TypeParse.DbObjToInt(dr["productid"].ToString(), 0); item.productname = TypeParse.DbObjToString(dr["productname"].ToString(), ""); item.vipprice = Convert.ToDecimal(TypeParse.DbObjToString(dr["vipprice"].ToString(), "100.00")); item.productprice = Convert.ToDecimal(TypeParse.DbObjToString(dr["productprice"].ToString(), "100.00")); item.productcode = TypeParse.DbObjToString(dr["productcode"].ToString(), ""); item.productbrief = TypeParse.DbObjToString(dr["productbrief"].ToString(), ""); item.productintroduce = TypeParse.DbObjToString(dr["productintroduce"].ToString(), ""); item.productimg = TypeParse.DbObjToString(dr["productimg"].ToString(), ""); item.smallcategoryid = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0); item.bigcategoryid = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0); item.smallcategory = TypeParse.DbObjToString(dr["smallcategory"].ToString(), ""); item.bigcategory = TypeParse.DbObjToString(dr["bigcategory"].ToString(), ""); item.brand = TypeParse.DbObjToString(dr["brand"].ToString(), ""); item.punit = TypeParse.DbObjToString(dr["punit"].ToString(), ""); item.adddate = TypeParse.DbObjToDateTime(dr["adddate"], DateTime.Now); item.editdate = TypeParse.DbObjToDateTime(dr["editdate"], DateTime.Now); item.salestate = TypeParse.DbObjToInt(dr["salestate"].ToString(), 0); item.placeid = TypeParse.DbObjToInt(dr["placeid"].ToString(), 0); item.place = TypeParse.DbObjToString(dr["place"].ToString(), ""); list.Add(item); } } } catch (Exception ex) { throw new Exception(ex.Message); } finally { } return(list); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { pageinfo pdata = new pageinfo(); int page; if (Request.QueryString["page"] != null) { page = TypeParse.DbObjToInt(Request.QueryString["page"].ToString(), 1); } else { page = 1; } pdata.curpageindex = page; pdata.pagesize = 10; pdata.where = "news.ntid=newstype.ntid"; pdata.recordcount = news.getnewscount(); pdata.tablename = "news ,newstype"; pdata.fieldlist = "news.newsid,news.newstitle,news.newswriter,news.newsfrom,news.newsnote,news.adddate,news.ntid,newstype.newstype,news.ninfo,news.istop,news.newsimg,news.userid"; pdata.sorttype = 2; pdata.primarykey = "newsid"; pdata.totalpagecount = (pdata.recordcount % pdata.pagesize == 0 ? pdata.recordcount / pdata.pagesize : pdata.recordcount / pdata.pagesize + 1); if (pdata.totalpagecount == 0) { pdata.totalpagecount = 1; } List <newsinfo> newslist = news.getnews(pdata); StringBuilder sb = new StringBuilder(); foreach (newsinfo item in newslist) { string template = "<tr><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\" >{0}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\" style=\"padding:0 0 0 5px;\"><div align=\"left\">{1}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"left\" style=\"padding:0 0 0 5px;\">{2}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{3}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{4}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\"><a href=\"/Manager/EditNews.aspx/?newsid={5}\" style=\"color:blue;cursor:pointer;\">编辑</a> | <a href=\"javascript:delnews('{6}','{7}')\" style=\"color:blue;cursor:pointer;\">删除</a></div></td></tr>"; sb.AppendFormat(template, item.adddate, comm.SubStr(item.newstitle, 17), item.newsfrom, item.newswriter, item.istop, item.newsid, item.newsid, pdata.curpageindex); } newslistHTML = sb.ToString(); pageHTML = pagehelper.Pager(pdata.curpageindex, pdata.pagesize, pdata.recordcount, PageMode.Numeric, 5); } }
/// <summary> /// 得到用户信息列表 /// </summary> /// <param name="pdata"></param> /// <returns></returns> public static List <userinfo> getUserList(pageinfo pdata) { List <userinfo> userlist = new List <userinfo>(); try { DataTable dt = pagehelper.getpagedt(pdata); if (dt != null) { foreach (DataRow reader in dt.Rows) { userinfo data = new userinfo(); data.userid = TypeParse.DbObjToString(reader["userid"], ""); data.email = TypeParse.DbObjToString(reader["email"], ""); data.accounts = TypeParse.DbObjToString(reader["accounts"], ""); data.tel = TypeParse.DbObjToString(reader["tel"], ""); data.mobile = TypeParse.DbObjToString(reader["mobile"], ""); data.headerimg = TypeParse.DbObjToString(reader["headerimg"], "noimg.jpg"); data.atid = TypeParse.DbObjToInt(reader["atid"], 1); data.accountstype = TypeParse.DbObjToString(reader["accountstype"], ""); data.truename = TypeParse.DbObjToString(reader["truename"], ""); data.qq = TypeParse.DbObjToString(reader["qq"], ""); data.company = TypeParse.DbObjToString(reader["company"], ""); data.address = TypeParse.DbObjToString(reader["address"], ""); data.adddate = TypeParse.DbObjToDateTime(reader["adddate"], DateTime.Now); userlist.Add(data); } } return(userlist); } catch (Exception E) { throw new Exception(E.Message); } finally { } }
/// <summary> /// 得到资讯列表 /// </summary> /// <param name="pdata"></param> /// <returns></returns> public static List <newsinfo> getnews(pageinfo pdata) { List <newsinfo> newslist = new List <newsinfo>(); try { DataTable dt = pagehelper.getpagedt(pdata); if (dt != null) { foreach (DataRow dr in dt.Rows) { newsinfo item = new newsinfo(); item.newsid = TypeParse.DbObjToInt(dr["newsid"].ToString(), 0); item.newstitle = TypeParse.DbObjToString(dr["newstitle"].ToString(), ""); item.newswriter = TypeParse.DbObjToString(dr["newswriter"].ToString(), ""); item.ntid = TypeParse.DbObjToInt(dr["ntid"].ToString(), 1); item.istop = TypeParse.DbObjToInt(dr["istop"].ToString(), 0); item.newsfrom = TypeParse.DbObjToString(dr["newsfrom"].ToString(), ""); item.newsnote = TypeParse.DbObjToString(dr["newsnote"].ToString(), ""); item.ninfo = TypeParse.DbObjToString(dr["ninfo"].ToString(), ""); item.newstype = TypeParse.DbObjToString(dr["newstype"].ToString(), ""); item.adddate = TypeParse.DbObjToDateTime(dr["adddate"].ToString(), DateTime.Now); item.newsimg = TypeParse.DbObjToString(dr["newsimg"].ToString(), "noimg.jpg"); item.userid = TypeParse.DbObjToString(dr["userid"].ToString(), ""); newslist.Add(item); } } } catch (Exception ex) { throw new Exception(ex.Message); } finally { } return(newslist); }
public static DataTable getpagedt(pageinfo pdata) { SqlParameter[] parms = new SqlParameter[8]; parms[0] = new SqlParameter("@pagesize", SqlDbType.Int); parms[0].Value = pdata.pagesize; parms[1] = new SqlParameter("@fieldlist", SqlDbType.VarChar, 2000); parms[1].Value = pdata.fieldlist; parms[2] = new SqlParameter("@tablename", SqlDbType.VarChar, 500); parms[2].Value = pdata.tablename; parms[3] = new SqlParameter("@where", SqlDbType.VarChar, 500); parms[3].Value = pdata.where; parms[4] = new SqlParameter("@sorttype", SqlDbType.Int); parms[4].Value = pdata.sorttype; parms[5] = new SqlParameter("@order", SqlDbType.VarChar, 200); parms[5].Value = pdata.order; parms[6] = new SqlParameter("@primarykey", SqlDbType.VarChar, 50); parms[6].Value = pdata.primarykey; parms[7] = new SqlParameter("@pageindex", SqlDbType.Int); parms[7].Value = pdata.curpageindex; StringBuilder sql = new StringBuilder(); string new_where2; string new_where1; string new_order; if (pdata.where == null || pdata.where == "") { new_where2 = " where "; new_where1 = ""; } else { new_where2 = " where " + pdata.where + " and "; new_where1 = " where " + pdata.where; } if (pdata.sorttype == 1) { new_order = " order by " + pdata.primarykey + " asc"; } else if (pdata.sorttype == 2) { new_order = " order by " + pdata.primarykey + " desc"; } else if (pdata.sorttype == 3) { new_order = " order by " + pdata.order; } else { new_order = " order by " + pdata.primarykey + " desc"; } if (pdata.curpageindex < 1) { pdata.curpageindex = 1; } if (pdata.curpageindex > pdata.totalpagecount) { pdata.curpageindex = pdata.totalpagecount; } if (pdata.curpageindex == 1) { sql.Append("select top " + pdata.pagesize + " " + pdata.fieldlist + " from " + pdata.tablename + " " + new_where1 + " " + new_order); } else { if (pdata.sorttype == 1) { sql.Append("SELECT TOP " + pdata.pagesize + " " + pdata.fieldlist + " FROM " + pdata.tablename + " " + new_where2 + " " + pdata.primarykey + " > " + " (SELECT MAX(" + pdata.primarykey + " ) FROM (SELECT TOP " + pdata.pagesize * (pdata.curpageindex - 1) + " " + pdata.primarykey + " " + " FROM " + pdata.tablename + " " + new_where1 + " " + new_order + " ) AS TMP) " + new_order); } if (pdata.sorttype == 2) { sql.Append("SELECT TOP " + pdata.pagesize + " " + pdata.fieldlist + " FROM " + pdata.tablename + " " + new_where2 + " " + pdata.primarykey + " < " + " (SELECT MIN(" + pdata.primarykey + " ) FROM (SELECT TOP " + pdata.pagesize * (pdata.curpageindex - 1) + " " + pdata.primarykey + " " + " FROM " + pdata.tablename + " " + new_where1 + " " + new_order + " ) AS TMP) " + new_order); } if (pdata.sorttype == 3) { sql.Append("SELECT TOP " + pdata.pagesize + " " + pdata.fieldlist + " FROM " + pdata.tablename + " " + new_where2 + " " + pdata.primarykey + " NOT IN (SELECT TOP " + pdata.pagesize * (pdata.curpageindex - 1) + " " + pdata.primarykey + " FROM " + pdata.tablename + " " + new_where1 + " " + new_order + ")" + new_order); } } DataTable dt = new DataTable(); try { dt = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql.ToString()).Tables[0]; return(dt); } catch (Exception E) { throw new Exception(E.Message); } finally { } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int page = 1; if (Request.QueryString["page"] != null) { page = TypeParse.DbObjToInt(Request.QueryString["page"].ToString(), 1); } pageinfo pdata = new pageinfo(); pdata.curpageindex = page; pdata.pagesize = 20; if (RouteData.Values["bcid"] != null && RouteData.Values["bcid"].ToString() != "0") { pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.bigcategoryid=" + RouteData.Values["bcid"].ToString(); pdata.recordcount = product.getproductcountbycondition("product.bigcategoryid=" + RouteData.Values["bcid"].ToString()); categoryinfo data = category.getbigcategoryinfo(TypeParse.DbObjToInt(RouteData.Values["bcid"].ToString(), 0)); ptypeHTML = data.bigcategory; } else if (RouteData.Values["scid"] != null && RouteData.Values["scid"].ToString() != "0") { pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.smallcategoryid=" + RouteData.Values["scid"].ToString(); pdata.recordcount = product.getproductcountbycondition("product.smallcategoryid=" + RouteData.Values["scid"].ToString()); categoryinfo data = category.getsmallcategoryinfo(TypeParse.DbObjToInt(RouteData.Values["scid"].ToString(), 0)); ptypeHTML = data.smallcategory; } else if (RouteData.Values["placeid"] != null && RouteData.Values["placeid"].ToString() != "0") { pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.placeid=" + RouteData.Values["placeid"].ToString(); pdata.recordcount = product.getproductcountbycondition("product.placeid=" + RouteData.Values["placeid"].ToString()); categoryinfo data = category.getplaceinfo(TypeParse.DbObjToInt(RouteData.Values["placeid"].ToString(), 0)); ptypeHTML = "水果产地:" + data.place; } else if (RouteData.Values["price"] != null && RouteData.Values["price"].ToString() != "0") { switch (RouteData.Values["price"].ToString()) { case "1": pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.vipprice>0 and product.vipprice<=50"; pdata.recordcount = product.getproductcountbycondition("product.vipprice>0 and product.vipprice<=50"); ptypeHTML = "价格0到50元水果"; break; case "2": pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.vipprice>50 and product.vipprice<=100"; pdata.recordcount = product.getproductcountbycondition("product.vipprice>50 and product.vipprice<=100"); ptypeHTML = "价格50到100元水果"; break; case "3": pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.vipprice>100 and product.vipprice<=200"; pdata.recordcount = product.getproductcountbycondition("product.vipprice>100 and product.vipprice<=200"); ptypeHTML = "价格100到200元水果"; break; case "4": pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.vipprice>200 and product.vipprice<=500"; pdata.recordcount = product.getproductcountbycondition("product.vipprice>200 and product.vipprice<=500"); ptypeHTML = "价格200到500元水果"; break; case "5": pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.vipprice>500"; pdata.recordcount = product.getproductcountbycondition("product.vipprice>500"); ptypeHTML = "价格500元以上水果"; break; default: pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid"; pdata.recordcount = product.getproductcount(); break; } } else if (RouteData.Values["pname"] != null && RouteData.Values["pname"].ToString() != "") { string pname = RouteData.Values["pname"].ToString(); pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.productname like'%" + RouteData.Values["pname"].ToString() + "%'"; pdata.recordcount = product.getproductcountbycondition("product.productname like '%" + RouteData.Values["pname"].ToString() + "%'"); categoryinfo data = category.getplaceinfo(TypeParse.DbObjToInt(RouteData.Values["placeid"].ToString(), 0)); ptypeHTML = "商品名称:" + pname; } else { pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid"; pdata.recordcount = product.getproductcount(); } pdata.tablename = "smallcategory,product,bigcategory,place"; pdata.fieldlist = "product.productid,product.productname,product.productprice,product.productcode,product.productbrief,product.productintroduce,product.vipprice,product.productimg,product.smallcategoryid,product.bigcategoryid,product.brand,product.punit,product.adddate,product.editdate,product.salestate,product.placeid,smallcategory.smallcategory,bigcategory.bigcategory,place.place"; pdata.sorttype = 2; pdata.primarykey = "productid"; pdata.totalpagecount = (pdata.recordcount % pdata.pagesize == 0 ? pdata.recordcount / pdata.pagesize : pdata.recordcount / pdata.pagesize + 1); if (pdata.totalpagecount == 0) { pdata.totalpagecount = 1; } List <productinfo> list = product.getproduct(pdata); StringBuilder sb = new StringBuilder(); foreach (productinfo item in list) { string template = "<div class=\"productlistli\"><a href=\"/PInfo/{0}.html\" class=\"plistimg\" title=\"{1}\" target=\"_blank\"><img src=\"/Files/Product/{2}\" /></a> <a href=\"/PInfo/{3}.html\" class=\"plisttitle\" title=\"{4}\" target=\"_blank\">{5}</a> <a href=\"/PInfo/{6}.html\" class=\"plistsite\" target=\"_blank\">规格:{7}</a> <a href=\"/PInfo/{8}.html\" class=\"plistprice\" target=\"_blank\"><span class=\"pricecss1\">¥{9}</span><span class=\"pricecss2\">¥{10}</span>{11}</a></div>"; sb.AppendFormat(template, item.productid, item.productname, item.productimg, item.productid, item.productname, comm.SubStr(item.productname, 15), item.productid, item.punit, item.productid, item.productprice, item.vipprice, item.salestate == 1 ? "<span class=\"sstate\">已售完</span>" : ""); } productlistHTML = sb.ToString(); pageHTML = pagehelper.Pager(pdata.curpageindex, pdata.pagesize, pdata.recordcount, PageMode.Numeric, 5); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //大目录 List <categoryinfo> alist = category.getbigcategory(); StringBuilder aselectsb = new StringBuilder(); aselectsb.Append("<select id=\"bcselect\" style=\"width:100px; border:solid 1px #cacaca; height:20px;z-index:100;\">"); foreach (categoryinfo item in alist) { string template = "<option value=\"{0}\">{1}</option>"; aselectsb.AppendFormat(template, item.bigcategoryid, item.bigcategory); } aselectsb.Append("</select>"); bcHTML = aselectsb.ToString(); int page = 1; if (Request.QueryString["page"] != null) { page = TypeParse.DbObjToInt(Request.QueryString["page"].ToString(), 1); } pageinfo pdata = new pageinfo(); pdata.curpageindex = page; pdata.pagesize = 20; if (Request.QueryString["pinfo"] != null) { string pname = HttpUtility.UrlDecode(Request.QueryString["pinfo"].ToString()); pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.productname like'%" + pname + "%'"; pdata.recordcount = product.getproductcountbycondition(" product.productname like '%" + pname + "%'"); } else if (Request.QueryString["bcid"] != null) { int bcid = TypeParse.DbObjToInt(Request.QueryString["bcid"].ToString(), 0); pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.bigcategoryid=" + bcid; pdata.recordcount = product.getproductcountbycondition(" product.bigcategoryid=" + bcid); } else if (Request.QueryString["state"] != null) { int state = TypeParse.DbObjToInt(Request.QueryString["state"].ToString(), 0); pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid and product.salestate=" + state; pdata.recordcount = product.getproductcountbycondition(" product.salestate=" + state); } else { pdata.where = "smallcategory.smallcategoryid=product.smallcategoryid and bigcategory.bigcategoryid=smallcategory.bigcategoryid and place.placeid=product.placeid"; pdata.recordcount = product.getproductcount(); } pdata.tablename = "smallcategory,product,bigcategory,place"; pdata.fieldlist = "product.productid,product.productname,product.productprice,product.productcode,product.productbrief,product.productintroduce,product.vipprice,product.productimg,product.smallcategoryid,product.bigcategoryid,product.brand,product.punit,product.adddate,product.editdate,product.salestate,product.placeid,smallcategory.smallcategory,bigcategory.bigcategory,place.place"; pdata.sorttype = 2; pdata.primarykey = "productid"; pdata.totalpagecount = (pdata.recordcount % pdata.pagesize == 0 ? pdata.recordcount / pdata.pagesize : pdata.recordcount / pdata.pagesize + 1); if (pdata.totalpagecount == 0) { pdata.totalpagecount = 1; } List <productinfo> list = product.getproduct(pdata); StringBuilder sb = new StringBuilder(); foreach (productinfo item in list) { string template = "<tr><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\" style=\"padding:5px 0;\"><img src=\"/Files/product/{0}\" style=\"width:120px;height:100px;\"/></div></td><td height=\"20\" bgcolor=\"#FFFFFF\" style=\"padding:0 0 0 5px;\"><div align=\"left\">{1}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\" style=\"padding:0 0 0 5px;\">{2}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\" style=\"padding:0 0 0 5px;\">{3}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\"><a href=\"javascript:ChangeSalestate('{4}','{5}','{6}')\" style=\"color:blue;cursor:pointer;\">{7}</a> | <a href=\"/Manager/EditProduct.aspx/?productid={8}\" style=\"color:blue;cursor:pointer;\">编辑</a> | <a href=\"javascript:delproduct('{9}','{10}')\" style=\"color:blue;cursor:pointer;\">删除</a></div></td></tr>"; sb.AppendFormat(template, item.productimg, item.productname, item.vipprice, item.salestate == 0 ? "<span style=\"color:green\">销售中</span>" : "<span style=\"color:red\">已下架</span>", item.productid, item.salestate == 0 ? "1" : "0", pdata.curpageindex, item.salestate == 1 ? "上架" : "下架", item.productid, item.productid, pdata.curpageindex); } productlistHTML = sb.ToString(); pageHTML = pagehelper.Pager(pdata.curpageindex, pdata.pagesize, pdata.recordcount, PageMode.Numeric, 5); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int allcount = user.getusernumbydate(0); int yearcount = user.getusernumbydate(1); int monthcount = user.getusernumbydate(2); int daycount = user.getusernumbydate(3); usertjHTML = "总会员:<span class=\"red\">" + allcount + "</span>个 今年注册<span class=\"red\">" + yearcount + "</span>个 本月注册<span class=\"red\">" + monthcount + "</span>个 今日注册<span class=\"red\">" + daycount + "</span>个 "; //账号类型 List <userinfo> alist = user.getaccountstype(); StringBuilder aselectsb = new StringBuilder(); aselectsb.Append("<select id=\"atselect\" style=\"width:100px; border:solid 1px #cacaca; height:20px;z-index:100;\">"); foreach (userinfo item in alist) { string template = "<option value=\"{0}\">{1}</option>"; aselectsb.AppendFormat(template, item.atid, item.accountstype); } aselectsb.Append("</select>"); atHTML = aselectsb.ToString(); pageinfo pdata = new pageinfo(); int page; if (Request.QueryString["page"] != null) { page = TypeParse.DbObjToInt(Request.QueryString["page"].ToString(), 1); } else { page = 1; } pdata.curpageindex = page; pdata.pagesize = 10; if (Request.QueryString["uinfo"] != null) { string uinfo = HttpUtility.UrlDecode(Request.QueryString["uinfo"].ToString()); pdata.where = "userinfo.atid=accountstype.atid and ( userinfo.accounts like'%" + uinfo + "%' or userinfo.email like '%" + uinfo + "%')"; } else if (Request.QueryString["atid"] != null) { pdata.where = "userinfo.atid=accountstype.atid and userinfo.atid=" + Request.QueryString["atid"].ToString(); } else { pdata.where = "userinfo.atid=accountstype.atid"; } pdata.recordcount = allcount; pdata.tablename = "userinfo,accountstype"; pdata.fieldlist = "userinfo.userid,userinfo.accounts,userinfo.email,userinfo.tel,userinfo.truename,userinfo.qq,userinfo.atid,userinfo.headerimg,userinfo.address,userinfo.mobile,userinfo.company,userinfo.adddate,accountstype.accountstype"; pdata.sorttype = 2; pdata.primarykey = "userid"; pdata.totalpagecount = (pdata.recordcount % pdata.pagesize == 0 ? pdata.recordcount / pdata.pagesize : pdata.recordcount / pdata.pagesize + 1); if (pdata.totalpagecount == 0) { pdata.totalpagecount = 1; } List <userinfo> userlist = user.getUserList(pdata); StringBuilder sb = new StringBuilder(); foreach (userinfo item in userlist) { string template = "<tr><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\" >{0}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{1}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{2}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{3}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{4}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{5}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"left\" style=\"padding:0 0 0 2px;\">{6}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{7}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\"><a href=\"javascript:edituser('{8}')\" style=\"color:blue;cursor:pointer;\">编辑</a> | <a href=\"javascript:deluser('{9}','{10}')\" style=\"color:blue;cursor:pointer;\">删除</a></div></td></tr>"; sb.AppendFormat(template, item.adddate, item.email, item.accounts, item.truename, item.tel, item.mobile, item.company, item.accountstype, item.userid, item.userid, pdata.curpageindex); } userlistHTML = sb.ToString(); pageHTML = pagehelper.Pager(pdata.curpageindex, pdata.pagesize, pdata.recordcount, PageMode.Numeric, 5); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string uid = ""; if (Request.Cookies["tfuid"] != null) { uid = TypeParse.DbObjToString(Request.Cookies["tfuid"].Value, ""); } else { Response.Redirect("/UserLog"); } int page = 1; if (Request.QueryString["page"] != null) { page = TypeParse.DbObjToInt(Request.QueryString["page"].ToString(), 1); } pageinfo pdata = new pageinfo(); pdata.curpageindex = page; pdata.pagesize = 10; if (RouteData.Values["orderstate"] != null) { pdata.where = "a.deliveryIid=c.deliveryIid and a.deliveryIIid=d.deliveryIIid and a.orderstate=" + RouteData.Values["orderstate"].ToString() + " and a.userid='" + uid + "'"; pdata.recordcount = order.getcountbycondition("userorder.orderstate=" + RouteData.Values["orderstate"].ToString() + " and userorder.userid='" + uid + "'"); if (RouteData.Values["orderstate"].ToString() == "0") { orderh3HTML = "我的进行中的订单"; } else if (RouteData.Values["orderstate"].ToString() == "10") { orderh3HTML = "我的已完成的订单"; } else if (RouteData.Values["orderstate"].ToString() == "44") { orderh3HTML = "我的待处理的订单"; } else { orderh3HTML = "我的订单"; } } else { pdata.where = "a.deliveryIid=c.deliveryIid and a.deliveryIIid=d.deliveryIIid and a.userid='" + uid + "'"; pdata.recordcount = order.getcountbycondition("userorder.userid='" + uid + "'"); orderh3HTML = "我的订单"; } pdata.tablename = "userorder a,deliveryI c,deliveryII d"; pdata.fieldlist = "a.orderid,a.orderstate,a.ordernumber,a.orderdate,a.deliverydate,a.allmoney,a.paymoney,a.contact,a.tel,a.mobile,a.address,c.deliveryI,d.deliveryII"; pdata.sorttype = 2; pdata.primarykey = "orderid"; pdata.totalpagecount = (pdata.recordcount % pdata.pagesize == 0 ? pdata.recordcount / pdata.pagesize : pdata.recordcount / pdata.pagesize + 1); if (pdata.totalpagecount == 0) { pdata.totalpagecount = 1; } List <orderinfo> list = order.getorderlist(pdata); StringBuilder sb = new StringBuilder(); foreach (orderinfo item in list) { string template = " <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"otb\"><tr style=\"height: 30px; line-height: 30px; background-color:#fff\"><td colspan=\"6\" style=\"padding-left: 10px;\"><span class=\"fb\">订单编号:{0}</span> 下单日期:{1} 送货日期:{2}</td></tr><tr style=\"height: 30px; line-height: 30px; background-color:#fff\"><td colspan=\"6\" style=\"padding-left: 10px;\">收货人:{3} 手机号码:{4} 固定电话:{5}</td></tr><tr style=\"height: 30px; line-height: 30px; background-color:#fff\"><td colspan=\"3\" style=\"padding-left: 10px;\">地址:{6}</td><td colspan=\"2\" align=\"center\">产品总额:¥{7}元</td><td align=\"center\">应付总额:<span class=\"fb red\">¥{8}元</span></td></tr><tr style=\"height: 30px; line-height: 30px; background-color:#efefef\"><td style=\"padding-left: 10px;\">序号</td><td align=\"center\">产品图片</td><td align=\"center\">产品名称</td><td align=\"center\">购买数量</td><td align=\"center\">产品单价 </td><td align=\"center\">小计</td></tr> "; sb.AppendFormat(template, item.ordernumber, item.orderdate, item.deliverydate, item.contact, item.tel, item.mobile, item.address, item.allmoney.ToString("f2"), item.paymoney.ToString("f2")); List <orderinfo> plist = order.getcartlistbyordernumber(item.ordernumber); for (int k = 0; k < plist.Count; k++) { string ptemplate = "<tr style=\"height: 30px; line-height: 30px; background-color:#fff\"><td style=\"padding-left: 10px;\">{0}</td><td align=\"center\" class=\"oimg\"><a href=\"/PInfo/{1}\" target=\"_blank\"><img src=\"/Files/Product/{2}\" /></a></td><td align=\"center\">{3}</td><td align=\"center\">{4}</td><td align=\"center\">{5}</td><td align=\"center\">{6}</td></tr>"; sb.AppendFormat(ptemplate, k + 1, plist[k].productid, plist[k].productimg, plist[k].productname, plist[k].buynum, plist[k].vipprice.ToString("f2"), (plist[k].vipprice * plist[k].buynum).ToString("f2")); } } sb.Append("</table>"); orderlistHTML = sb.ToString(); pageHTML = pagehelper.Pager(pdata.curpageindex, pdata.pagesize, pdata.recordcount, PageMode.Numeric, 5); } }