/// <summary> /// Adds the contents of another <see cref="GoodsinfoCollection">GoodsinfoCollection</see> to the end of the collection. /// </summary> /// <param name="value">A <see cref="GoodsinfoCollection">GoodsinfoCollection</see> containing the Components to add to the collection. </param> public void AddRange(GoodsinfoCollection value) { for (int i = 0; (i < value.Count); i = (i + 1)) { this.Add((Goodsinfo)value.List[i]); } }
/// <summary> /// Initializes a new instance of the <see cref="GoodsinfoCollection">GoodsinfoCollection</see> class containing the elements of the specified source collection. /// </summary> /// <param name="value">A <see cref="GoodsinfoCollection">GoodsinfoCollection</see> with which to initialize the collection.</param> public GoodsinfoCollection(GoodsinfoCollection value) { this.AddRange(value); }
/// <summary> /// Initializes a new instance of the <see cref="GoodsinfoCollectionEnumerator">GoodsinfoCollectionEnumerator</see> class referencing the specified <see cref="GoodsinfoCollection">GoodsinfoCollection</see> object. /// </summary> /// <param name="mappings">The <see cref="GoodsinfoCollection">GoodsinfoCollection</see> to enumerate.</param> public GoodsinfoCollectionEnumerator(GoodsinfoCollection mappings) { _temp = ((IEnumerable)(mappings)); _enumerator = _temp.GetEnumerator(); }
private string condition = ""; //查询条件 protected override void ShowPage() { if (config.Enablemall == 0) //未启用交易模式 { AddErrLine("系统未开启交易模式, 当前页面暂时无法访问!"); return; } else goodscategoryfid = Discuz.Mall.GoodsCategories.GetGoodsCategoryWithFid(); forumnav = ""; forumallowrss = 0; if (categoryid <= 0) { AddErrLine("无效的商品分类ID"); return; } if (config.Enablemall == 2) //开启高级模式 { AddLinkRss("mallgoodslist.aspx?categoryid=" + categoryid, "商品列表"); AddErrLine("当前页面在开启商城(高级)模式下无法访问, 系统将会重定向到商品列表页面!"); return; } goodscategoryinfo = GoodsCategories.GetGoodsCategoryInfoById(categoryid); if (goodscategoryinfo != null && goodscategoryinfo.Categoryid > 0) { forumid = GoodsCategories.GetCategoriesFid(goodscategoryinfo.Categoryid); } else { AddErrLine("无效的商品分类ID"); return; } ///得到广告列表 ///头部 headerad = Advertisements.GetOneHeaderAd("", forumid); footerad = Advertisements.GetOneFooterAd("", forumid); pagewordad = Advertisements.GetPageWordAd("", forumid); doublead = Advertisements.GetDoubleAd("", forumid); floatad = Advertisements.GetFloatAd("", forumid); mediaad = Advertisements.GetMediaAd(templatepath, "", forumid); disablepostctrl = 0; if (userid > 0 && useradminid > 0) admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid); if (admingroupinfo != null) this.disablepostctrl = admingroupinfo.Disablepostctrl; if (forumid == -1) { AddLinkRss("tools/rss.aspx", "最新商品"); AddErrLine("无效的商品分类ID"); return; } else { forum = Forums.GetForumInfo(forumid); // 检查是否具有版主的身份 if (useradminid > 0) ismoder = Moderators.IsModer(useradminid, userid, forumid); #region 对搜索条件进行检索 string orderStr = "goodsid"; if (DNTRequest.GetString("search").Trim() != "") //进行指定查询 { //所在城市信息 cond = DNTRequest.GetInt("locus_2", -1); if (cond < 1) condition = ""; else { locus = Locations.GetLocusByLID(cond); condition = "AND [lid] = " + cond; } //排序的字段 order = DNTRequest.GetInt("order", -1); switch (order) { case 2: orderStr = "expiration"; //到期日 break; case 1: orderStr = "price"; //商品价格 break; default: orderStr = "goodsid"; break; } if (DNTRequest.GetInt("direct", -1) == 0) direct = 0; } #endregion if (forum == null) { if (config.Rssstatus == 1) AddLinkRss("tools/rss.aspx", Utils.EncodeHtml(config.Forumtitle) + " 最新商品"); AddErrLine("不存在的商品分类ID"); return; } //当版块有外部链接时,则直接跳转 if (forum.Redirect != null && forum.Redirect != string.Empty) { System.Web.HttpContext.Current.Response.Redirect(forum.Redirect); return; } if (forum.Istrade <= 0) { AddErrLine("当前版块不允许商品交易"); forumnav = ""; return; } if (forum.Fid < 1) { if (config.Rssstatus == 1 && forum.Allowrss == 1) AddLinkRss("tools/" + base.RssAspxRewrite(forum.Fid), Utils.EncodeHtml(forum.Name) + " 最新商品"); AddErrLine("不存在的商品分类ID"); return; } if (config.Rssstatus == 1) AddLinkRss("tools/" + base.RssAspxRewrite(forum.Fid), Utils.EncodeHtml(forum.Name) + " 最新商品"); forumname = forum.Name; pagetitle = Utils.RemoveHtml(forum.Name); subforumcount = forum.Subforumcount; forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname); navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); //更新页面Meta中的Description项, 提高SEO友好性 UpdateMetaInfo(config.Seokeywords, forum.Description, config.Seohead); // 是否显示版块密码提示 1为显示, 0不显示 showforumlogin = 1; // 如果版块未设密码 if (forum.Password == "") showforumlogin = 0; else { // 如果检测到相应的cookie正确 if (Utils.MD5(forum.Password) == ForumUtils.GetCookie("forum" + forumid.ToString() + "password")) showforumlogin = 0; else { // 如果用户提交的密码正确则保存cookie if (forum.Password == DNTRequest.GetString("forumpassword")) { ForumUtils.WriteCookie("forum" + forumid.ToString() + "password", Utils.MD5(forum.Password)); showforumlogin = 0; } } } if (!Forums.AllowViewByUserId(forum.Permuserlist, userid)) //判断当前用户在当前版块浏览权限 { if (forum.Viewperm == null || forum.Viewperm == string.Empty) //当板块权限为空时,按照用户组权限 { if (useradminid != 1 && (usergroupinfo.Allowvisit != 1 || usergroupinfo.Allowtrade != 1)) { AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有浏览该商品分类的权限"); if (userid == -1) { needlogin = true; } return; } } else //当板块权限不为空,按照板块权限 { if (!Forums.AllowView(forum.Viewperm, usergroupid)) { AddErrLine("您没有浏览该商品分类的权限"); if (userid == -1) { needlogin = true; } return; } } } ////判断是否有发主题的权限 if (userid > -1 && Forums.AllowPostByUserID(forum.Permuserlist, userid)) canposttopic = true; if (forum.Postperm == null || forum.Postperm == string.Empty) //权限设置为空时,根据用户组权限判断 { // 验证用户是否有发表交易的权限 if (usergroupinfo.Allowtrade == 1) { canposttopic = true; } } else if (Forums.AllowPost(forum.Postperm, usergroupid)) { canposttopic = true; } // 如果当前用户非管理员并且论坛设定了禁止发帖时间段,当前时间如果在其中的一个时间段内,不允许用户发帖 if (useradminid != 1 && usergroupinfo.Disableperiodctrl != 1) { string visittime = ""; if (Scoresets.BetweenTime(config.Postbanperiods, out visittime)) canposttopic = false; } if (newpmcount > 0) { pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1); showpmhint = Convert.ToInt32(Users.GetShortUserInfo(userid).Newsletter) > 4; } //得到子分类JSON格式 subcategoriesjson = GoodsCategories.GetSubCategoriesJson(categoryid); //得到当前用户请求的页数 pageid = DNTRequest.GetInt("page", 1); //获取主题总数 goodscount = Goods.GetGoodsCount(categoryid, condition); // 得到gpp设置 if (gpp <= 0) gpp = config.Gpp; if (gpp <= 0) gpp = 16; //修正请求页数中可能的错误 if (pageid < 1) pageid = 1; if (forum.Layer > 0) { //获取总页数 pagecount = goodscount % gpp == 0 ? goodscount / gpp : goodscount / gpp + 1; if (pagecount == 0) pagecount = 1; if (pageid > pagecount) pageid = pagecount; goodslist = Goods.GetGoodsInfoList(categoryid, gpp, pageid, condition, orderStr, direct); ForumUtils.WriteCookie("referer", string.Format("showgoodslist.aspx?categoryid={0}&page={1}&order={2}&direct={3}&locus2={4}&search={5}", categoryid.ToString(), pageid.ToString(), orderStr, direct, cond, DNTRequest.GetString("search"))); //得到页码链接 if (DNTRequest.GetString("search") == "") { if (categoryid == 0) { if (config.Aspxrewrite == 1) { pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, "showgoodslist-" + categoryid.ToString(), config.Extname, 8); } else { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "showgoodslist.aspx?categoryid=" + categoryid.ToString(), 8); } } else //当有类型条件时 { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "showgoodslist.aspx?categoryid=" + categoryid, 8); } } else { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "showgoodslist.aspx?search=" + DNTRequest.GetString("search") + "&order=" + 2 + "&direct=" + direct + "&categoryid=" + categoryid + "&locus_2=" + cond , 8); } } } forumlistboxoptions = Caches.GetForumListBoxOptionsCache(); OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, forumname, -1, ""); showforumonline = false; onlineiconlist = Caches.GetOnlineGroupIconList(); if (forumtotalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes") { showforumonline = true; onlineuserlist = OnlineUsers.GetForumOnlineUserCollection(forumid, out forumtotalonline, out forumtotalonlineguest, out forumtotalonlineuser, out forumtotalonlineinvisibleuser); } if (DNTRequest.GetString("showonline") == "no") showforumonline = false; ForumUtils.UpdateVisitedForumsOptions(forumid); visitedforumsoptions = ForumUtils.GetVisitedForumsOptions(config.Visitedforums); //因为目前还未提供RSS功能,所以下面两项为0 forumallowrss = 0; }
/// <summary> /// 查询条件 /// </summary> //public string condition = ""; #endregion protected override void ShowPage() { // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); announcementcount = 0; if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } inforumad = ""; floatad = Advertisements.GetFloatAd("indexad", 0); doublead = Advertisements.GetDoubleAd("indexad", 0); mediaad = Advertisements.GetMediaAd(templatepath, "indexad", 0); if (config.Enablemall <= 1) //开启普通模式 { AddErrLine("当前页面只有在开启商城(高级)模式下才可访问"); return; } new_goodsinfocoll = Goods.GetGoodsInfoList(3, 1, "", "goodsid", 1); sec_hand_goodsinfocoll = Goods.GetGoodsInfoList(9, 1, DatabaseProvider.GetInstance().GetGoodsQualityCondition((int)MallUtils.OperaCode.Equal, 2), "goodsid", 1); one_yuan_goodsinfocoll = Goods.GetGoodsInfoList(9, 1, DatabaseProvider.GetInstance().GetGoodsPriceCondition((int)MallUtils.OperaCode.Equal, 1), "goodsid", 1); recommend_goodsinfocoll = Goods.GetGoodsInfoList(10, 1, DatabaseProvider.GetInstance().GetGoodsRecommendCondition((int)MallUtils.OperaCode.Equal, 1), "goodsid", 1); goodscategory = GoodsCategories.GetRootGoodsCategoriesJson(); rootgoodscategoryarray = GoodsCategories.GetShopRootCategory(); }
protected override void ShowPage() { if (userid == -1) { AddErrLine("你尚未登录"); return; } if (config.Enablemall < 2) { AddErrLine("当前操作只有在开启商城(高级)模式时才可以使用!"); return; } user = Users.GetUserInfo(userid); if (item == "") item = "shopcategory"; if(item == "recommend") recommendgoodslist = Goods.GetGoodsRecommendManageList(userid, 6, 1, ""); reccount = (shopgoodscategoryid <= 0) ? Goods.GetGoodsCountBySellerUid(userid, true) : Goods.GetGoodsCountByShopCategory(shopgoodscategoryid,""); // 得到分页大小设置 int pagesize = 10; //修正请求页数中可能的错误 if (pageid < 1) pageid = 1; //获取总页数 pagecount = reccount % pagesize == 0 ? reccount / pagesize : reccount / pagesize + 1; if (pagecount == 0) pagecount = 1; if (pageid > pagecount) pageid = pagecount; shopinfo = Shops.GetShopByUserId(user.Uid); //如果不是提交... if (!ispost) { if (shopgoodscategoryid <= 0) goodslist = Goods.GetGoodsListBySellerUID(userid, true, pagesize, pageid, "lastupdate", 1); else goodslist = Goods.GetGoodsInfoListByShopCategory(shopgoodscategoryid, pagesize, pageid, "", "lastupdate", 1); pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid, 8); shopcategorydt = ShopCategories.GetShopCategoryTable(shopinfo.Shopid); shopcategorydt_count = shopcategorydt.Rows.Count; shopcategorydata = ShopCategories.GetShopCategoryJson(shopcategorydt); categoryoptions = ShopCategories.GetShopCategoryOption(shopcategorydt, true); } else { string operation = DNTRequest.GetString("operation"); if (operation == "") operation = "movecategory"; switch (operation) { case "movecategory": //移动到商品分类 { if (goodsidlist == "") { AddErrLine("你未选中任何商品"); return; } int selectcategoryid = DNTRequest.GetInt("selectcategoryid", 0); if (selectcategoryid <= 0) { AddErrLine("你未选择要移动到的商品分类"); return; } if (Goods.IsSeller(goodsidlist, userid)) { if (Goods.MoveGoodsShopCategory(goodsidlist, selectcategoryid) > 0) { SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); } else { AddErrLine("商品参数信息无效或所选商品已在该分类下"); return; } } else { AddErrLine("你不是当前商品的卖家,因此无法移动该商品到指定的分类"); return; } break; } case "removecategory": //移除商品分类 { int removeshopgoodscategoryid = DNTRequest.GetInt("removeshopgoodscategoryid", 0); int removegoodsid = DNTRequest.GetInt("removegoodsid", 0); if (removeshopgoodscategoryid <= 0 || removegoodsid <= 0) { AddErrLine("移除分类信息错误"); return; } if (Goods.IsSeller(removegoodsid.ToString(), userid)) { if (Goods.RemoveGoodsShopCategory(removegoodsid, removeshopgoodscategoryid) > 0) { SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); } else { AddErrLine("商品参数信息无效或所选商品已在该分类下"); return; } } else { AddErrLine("您不是当前商品的卖家,因此无法移除该商品的分类"); return; } break; } case "recommend": //推荐商品 { if (goodsidlist == "") { AddErrLine("您未选中任何商品"); return; } if ((recommendgoodslist.Count + goodsidlist.Split(',').Length) > 5) { AddErrLine("您推荐的商品总数已大于5, 因为无法进行推荐"); return; } if (Goods.IsSeller(goodsidlist, userid)) { Goods.RecommendGoods(goodsidlist); SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); } else { AddErrLine("您不是当前商品的卖家,因此无法推荐该商品"); return; } break; } case "cancelrecommend": //取消推荐商品 { goodsidlist = DNTRequest.GetString("cancelrecommendgoodsid"); if (goodsidlist == "") { AddErrLine("您未选中任何商品"); return; } if (Goods.IsSeller(goodsidlist, userid)) { Goods.CancelRecommendGoods(goodsidlist); SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); } else { AddErrLine("你不是当前商品的卖家,因此无法取消推荐该商品"); return; } break; } case "updatedisplayorder": //更新商品显示顺序 { foreach (Goodsinfo goodsinfo in recommendgoodslist) { //当显示顺序值发生变化时,则更新相应的商品信息 if (goodsinfo.Displayorder != DNTRequest.GetInt("displayorder_" + goodsinfo.Goodsid, 0)) { goodsinfo.Displayorder = DNTRequest.GetInt("displayorder_" + goodsinfo.Goodsid, 0); Goods.UpdateGoods(goodsinfo); } } SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); break; } } } }
private void BindItem() { switch (listtype) { case "spacepost": SpacePluginBase spb = SpacePluginProvider.GetInstance(); if (spb == null) { AddErrLine("未安装空间插件"); return; } spacepostcount = spb.GetSpacePostCountWithSameTag(tagid); SetPage(spacepostcount); if (spacepostcount > 0) { spacepostlist = spb.GetSpacePostsWithSameTag(tagid, pageid, config.Tpp); pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "tags.aspx?t=spacepost&tagid=" + tagid, 8); } else AddMsgLine("该标签下暂无日志"); break; case "photo": AlbumPluginBase apb = AlbumPluginProvider.GetInstance(); if (apb == null) { AddErrLine("未安装相册插件"); return; } photocount = apb.GetPhotoCountWithSameTag(tagid); SetPage(photocount); if (photocount > 0) { photolist = apb.GetPhotosWithSameTag(tagid, pageid, config.Tpp); foreach (PhotoInfo photo in photolist) { if (photo.Filename.IndexOf("http") < 0) //当是远程照片时 photo.Filename = forumpath + AlbumPluginProvider.GetInstance().GetThumbnailImage(photo.Filename); else photo.Filename = AlbumPluginProvider.GetInstance().GetThumbnailImage(photo.Filename); } pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "tags.aspx?t=photo&tagid=" + tagid, 8); } else AddMsgLine("该标签下暂无图片"); break; case "mall": if (MallPluginProvider.GetInstance() == null) { AddErrLine("未安装商城插件"); return; } goodscount = MallPluginProvider.GetInstance().GetGoodsCountWithSameTag(tagid); SetPage(goodscount); if (goodscount > 0) { goodslist = MallPluginProvider.GetInstance().GetGoodsWithSameTag(tagid, pageid, config.Tpp); pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "tags.aspx?t=mall&tagid=" + tagid, 8); } else AddMsgLine("该标签下暂无商品"); break; case "topic": topiccount = Topics.GetTopicCountByTagId(tagid); SetPage(topiccount); if (topiccount > 0) { topiclist = Topics.GetTopicListByTagId(tagid, pageid, config.Tpp); pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "tags.aspx?t=topic&tagid=" + tagid, 8); } else AddMsgLine("该标签下暂无主题"); break; } }
protected override void ShowPage() { if (userid == -1) { AddErrLine("你尚未登录"); return; } if (config.Enablemall == 0) //未启用交易服务 { AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!"); return; } user = Users.GetUserInfo(userid); if (item == "") item = "tradestats"; //当显示交易日志(不是出售中商品) if ((item == "selltrade" && filter != "onsell" && filter != "allgoods") || item == "buytrade") istradeloglist = true; //当为评价,交易成功或退款时,则显示评价字段信息 if (filter == "eccredit" || filter == "success" || filter == "refund") isshowrate = true; //获取当前用户的商品数 if (filter == "allgoods" || filter == "onsell" || item == "tradestats") reccount = (filter == "allgoods") ? Goods.GetGoodsCountBySellerUid(userid, true) : Goods.GetGoodsCountBySellerUid(userid, false); else { //获取当前用户做为卖家的交易数 if (item == "selltrade") reccount = TradeLogs.GetGoodsTradeLogCount(userid, goodsidlist, 1, filter); else //获取当前用户做为买家的交易数 reccount = TradeLogs.GetGoodsTradeLogCount(userid, goodsidlist, 2, filter); } if (item == "tradestats") { tradestatisticinfo = TradeLogs.GetTradeStatistic(user.Uid); return; } // 得到分页大小设置 int pagesize = 10; //修正请求页数中可能的错误 if (pageid < 1) pageid = 1; //获取总页数 pagecount = reccount % pagesize == 0 ? reccount / pagesize : reccount / pagesize + 1; if (pagecount == 0) pagecount = 1; if (pageid > pagecount) pageid = pagecount; //如果不是提交... if (!ispost) { if (item == "selltrade" && (filter == "allgoods" || filter == "onsell")) { if (filter == "allgoods") goodslist = Goods.GetGoodsListBySellerUID(userid, true, pagesize, pageid, "lastupdate", 1); else goodslist = Goods.GetGoodsListBySellerUID(userid, false, pagesize, pageid, "lastupdate", 1); pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "usercpmygoods.aspx?item=" + item + "&filter=" + filter , 8); } else { if (item == "selltrade") goodstradeloglist = TradeLogs.GetGoodsTradeLogList(userid, goodsidlist, 1, filter, pagesize, pageid); else goodstradeloglist = TradeLogs.GetGoodsTradeLogList(userid, goodsidlist, 2, filter, pagesize, pageid); pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "usercpmygoods.aspx?item=" + item + "&filter=" + filter, 8); } } else { string operation = DNTRequest.GetString("operation"); if (operation == "") operation = "deletegoods"; if (operation == "deletegoods") { if (goodsidlist == "") { AddErrLine("你未选中任何商品"); return; } if (Goods.IsSeller(goodsidlist, userid)) { Goods.DeleteGoods(goodsidlist, false); SetUrl("usercpmygoods.aspx?item=" + item + "&filter=" + filter); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpmygoods.aspx?item=" + item + "&filter=" + filter + "\">点击这里返回</a>)<br />"); } else { AddErrLine("你不是当前商品的卖家,因此无法删除该商品"); return; } } } }
/// <summary> /// 获得商品信息(DTO) /// </summary> /// <param name="idatareader">要转换的数据</param> /// <returns>返回商品信息</returns> public static GoodsinfoCollection GetGoodsInfoList(IDataReader reader) { GoodsinfoCollection goodsinfocoll = new GoodsinfoCollection(); //StringBuilder tablefield = new StringBuilder().Capacity(2000); //tablefield.Append(","); //foreach (DataRow dr in __idatareader.GetSchemaTable().Rows) //{ // tablefield.Append(dr["ColumnName"].ToString().ToLower() + ","); //} while (reader.Read()) { Goodsinfo goodsinfo = new Goodsinfo(); //if (tablefield.ToString().IndexOf(",goodsid,")>=0) //{ goodsinfo.Goodsid = TypeConverter.ObjectToInt(reader["goodsid"]); //} goodsinfo.Shopid = TypeConverter.ObjectToInt(reader["shopid"]); goodsinfo.Parentcategorylist = reader["parentcategorylist"].ToString(); goodsinfo.Shopcategorylist = reader["shopcategorylist"].ToString(); goodsinfo.Categoryid = TypeConverter.ObjectToInt(reader["categoryid"]); goodsinfo.Recommend = TypeConverter.ObjectToInt(reader["recommend"]); goodsinfo.Discount = TypeConverter.ObjectToInt(reader["discount"]); goodsinfo.Selleruid = TypeConverter.ObjectToInt(reader["selleruid"]); goodsinfo.Seller = reader["seller"].ToString(); goodsinfo.Account = reader["account"].ToString(); goodsinfo.Magic = TypeConverter.ObjectToInt(reader["magic"]); goodsinfo.Price = Convert.ToDecimal(reader["price"]); goodsinfo.Amount = TypeConverter.ObjectToInt(reader["amount"]); goodsinfo.Quality = TypeConverter.ObjectToInt(reader["quality"]); goodsinfo.Lid = TypeConverter.ObjectToInt(reader["lid"]); goodsinfo.Locus = reader["locus"].ToString(); goodsinfo.Transport = TypeConverter.ObjectToInt(reader["transport"]); goodsinfo.Ordinaryfee = Convert.ToDecimal(reader["ordinaryfee"].ToString()); goodsinfo.Expressfee = Convert.ToDecimal(reader["expressfee"].ToString()); goodsinfo.Emsfee = Convert.ToDecimal(reader["emsfee"].ToString()); goodsinfo.Itemtype = TypeConverter.ObjectToInt(reader["itemtype"]); goodsinfo.Dateline = Convert.ToDateTime(reader["dateline"].ToString()); goodsinfo.Expiration = Convert.ToDateTime(reader["expiration"].ToString()); goodsinfo.Lastbuyer = reader["lastbuyer"].ToString(); goodsinfo.Lasttrade = Convert.ToDateTime(reader["lasttrade"].ToString()); goodsinfo.Lastupdate = Convert.ToDateTime(reader["lastupdate"].ToString()); goodsinfo.Totalitems = TypeConverter.ObjectToInt(reader["totalitems"]); goodsinfo.Tradesum = Convert.ToDecimal(reader["tradesum"].ToString()); goodsinfo.Closed = TypeConverter.ObjectToInt(reader["closed"]); goodsinfo.Aid = TypeConverter.ObjectToInt(reader["aid"]); goodsinfo.Goodspic = reader["goodspic"].ToString().Trim(); goodsinfo.Displayorder = TypeConverter.ObjectToInt(reader["displayorder"]); goodsinfo.Costprice = Convert.ToDecimal(reader["costprice"].ToString()); goodsinfo.Invoice = TypeConverter.ObjectToInt(reader["invoice"]); goodsinfo.Repair = TypeConverter.ObjectToInt(reader["repair"]); goodsinfo.Message = reader["message"].ToString(); goodsinfo.Otherlink = reader["otherlink"].ToString(); goodsinfo.Readperm = TypeConverter.ObjectToInt(reader["readperm"]); goodsinfo.Tradetype = TypeConverter.ObjectToInt(reader["tradetype"]); goodsinfo.Viewcount = TypeConverter.ObjectToInt(reader["viewcount"]); goodsinfo.Smileyoff = TypeConverter.ObjectToInt(reader["smileyoff"]); goodsinfo.Bbcodeoff = TypeConverter.ObjectToInt(reader["bbcodeoff"]); goodsinfo.Parseurloff = TypeConverter.ObjectToInt(reader["parseurloff"]); goodsinfo.Highlight = reader["highlight"].ToString().Trim(); goodsinfo.Title = reader["title"].ToString().Trim(); goodsinfo.Htmltitle = SetMagicTitle(goodsinfo); goodsinfocoll.Add(goodsinfo); } reader.Close(); return goodsinfocoll; }
/// <summary> /// 获取指定分类和条件下的商品列表集合 /// </summary> /// <param name="selleruid">卖家uid</param> /// <param name="allgoods">是否全部商品</param> /// <param name="pagesize">页面大小</param> /// <param name="pageindex">当前页</param> /// <param name="orderby">排序字段</param> /// <param name="ascdesc">排序方式(0:升序, 1:降序)</param> /// <returns>商品列表集合</returns> public static GoodsinfoCollection GetGoodsListBySellerUID(int sellerUid, bool allGoods, int pageSize, int pageIndex, string orderBy, int ascDesc) { GoodsinfoCollection coll = new GoodsinfoCollection(); if (pageIndex <= 0) return coll; string condition = ""; if (!allGoods) { condition += DbProvider.GetInstance().GetGoodsDateLineCondition((int)MallUtils.OperaCode.MorethanOrEqual, 0); condition += DbProvider.GetInstance().GetGoodsDisplayCondition((int)MallUtils.OperaCode.MorethanOrEqual, 0); } return DTO.GetGoodsInfoList(DbProvider.GetInstance().GetGoodsListBySellerUID(sellerUid, pageSize, pageIndex, condition, orderBy, ascDesc)); }
/// <summary> /// 获取指定条件的商品信息列表 /// </summary> /// <param name="pagesize">页面大小</param> /// <param name="pageindex">当前页</param> /// <param name="condition">条件</param> /// <param name="orderby">排序字段</param> /// <param name="ascdesc">排序方式</param> /// <returns>商品信息列表</returns> public static GoodsinfoCollection GetGoodsInfoList(int pageSize, int pageIndex, string condition, string orderBy, int ascDesc) { GoodsinfoCollection coll = new GoodsinfoCollection(); if (pageIndex <= 0) return coll; condition += DbProvider.GetInstance().GetGoodsDisplayCondition((int)MallUtils.OperaCode.MorethanOrEqual, 0); condition += DbProvider.GetInstance().GetGoodsCloseCondition((int)MallUtils.OperaCode.Equal, 0); condition += DbProvider.GetInstance().GetGoodsExpirationCondition((int)MallUtils.OperaCode.LessthanOrEqual, 0); condition += DbProvider.GetInstance().GetGoodsDateLineCondition((int)MallUtils.OperaCode.MorethanOrEqual, 0); condition += DbProvider.GetInstance().GetGoodsRemainCondition((int)MallUtils.OperaCode.Morethan, 0); return DTO.GetGoodsInfoList(DbProvider.GetInstance().GetGoodsList(pageSize, pageIndex, condition, orderBy, ascDesc)); }
/// <summary> /// 获取指定店铺商品分类id的商品列表 /// </summary> /// <param name="shopcategoryid">店铺商品分类id</param> /// <param name="pagesize">页面大小</param> /// <param name="pageindex">当前页</param> /// <param name="condition">查询条件</param> /// <param name="orderby">排序字段</param> /// <param name="ascdesc">排序方法</param> /// <returns>商品列表</returns> public static GoodsinfoCollection GetGoodsInfoListByShopCategory(int shopCategoryId, int pageSize, int pageIndex, string condition, string orderBy, int ascDesc) { GoodsinfoCollection coll = new GoodsinfoCollection(); if (pageIndex <= 0) return coll; return DTO.GetGoodsInfoList(DbProvider.GetInstance().GetGoodsInfoListByShopCategory(shopCategoryId, pageSize, pageIndex, condition, orderBy, ascDesc)); }
private string condition = ""; //查询条件 protected override void ShowPage() { // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); announcementcount = 0; if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } inforumad = ""; floatad = Advertisements.GetFloatAd("indexad", 0); doublead = Advertisements.GetDoubleAd("indexad", 0); mediaad = Advertisements.GetMediaAd(templatepath, "indexad", 0); if (config.Enablemall <= 1) //开启普通模式 { AddErrLine("当前页面只有在开启商城(高级)模式下才可访问"); return; } categoryid = DNTRequest.GetInt("categoryid", 0); if (categoryid <= 0) { AddErrLine("无效的商品分类I1"); return; } goodscategoryinfo = GoodsCategories.GetGoodsCategoryInfoById(categoryid); if (goodscategoryinfo == null || goodscategoryinfo.Categoryid <= 0) { AddErrLine("无效的商品分类ID"); return; } string orderStr = "goodsid"; condition = ""; //得到当前用户请求的页数 pageid = DNTRequest.GetInt("page", 1); //获取主题总数 goodscount = Goods.GetGoodsCount(categoryid, condition); // 得到gpp设置 gpp = 16;//Utils.StrToInt(ForumUtils.GetCookie("tpp"), config.Tpp); if (gpp <= 0) { gpp = config.Tpp; } //修正请求页数中可能的错误 if (pageid < 1) { pageid = 1; } //获取总页数 pagecount = goodscount % gpp == 0 ? goodscount / gpp : goodscount / gpp + 1; if (pagecount == 0) { pagecount = 1; } if (pageid > pagecount) { pageid = pagecount; } goodslist = Goods.GetGoodsInfoList(goodscategoryinfo.Categoryid, gpp, pageid, condition, orderStr, direct); if (config.Aspxrewrite == 1) { pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, "mallgoodslist-" + categoryid.ToString(), config.Extname, 8); } else { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "mallgoodslist.aspx?categoryid=" + categoryid.ToString(), 8); } //得到子分类JSON格式 subcategoriesjson = GoodsCategories.GetSubCategoriesJson(goodscategoryinfo.Categoryid); new_goodsinfocoll = Goods.GetGoodsInfoList(3, 1, "", "goodsid", 1); sec_hand_goodsinfocoll = Goods.GetGoodsInfoList(9, 1, DatabaseProvider.GetInstance().GetGoodsQualityCondition((int)MallUtils.OperaCode.Equal, 2), "goodsid", 1); one_yuan_goodsinfocoll = Goods.GetGoodsInfoList(9, 1, DatabaseProvider.GetInstance().GetGoodsPriceCondition((int)MallUtils.OperaCode.Equal, 1), "goodsid", 1); recommend_goodsinfocoll = Goods.GetGoodsInfoList(10, 1, DatabaseProvider.GetInstance().GetGoodsRecommendCondition((int)MallUtils.OperaCode.Equal, 1), "goodsid", 1); goodscategory = GoodsCategories.GetRootGoodsCategoriesJson(); rootgoodscategoryarray = GoodsCategories.GetShopRootCategory(); }