コード例 #1
0
		/// <summary>
		/// Copies the elements of the specified <see cref="GoodsinfoCollection">GoodsinfoCollection</see> array to the end of the collection.
		/// </summary>
		/// <param name="value">An array of type <see cref="GoodsinfoCollection">GoodsinfoCollection</see> containing the Components to add to the collection.</param>
        public void AddRange(Goodsinfo[] value) 
		{
			for (int i = 0;	(i < value.Length); i = (i + 1)) 
			{
				this.Add(value[i]);
			}
		}
コード例 #2
0
ファイル: SqlDataProvider.cs プロジェクト: wenysky/dnt31-lite
        /// <summary>
        /// 更新商品
        /// </summary>
        /// <param name="goods">要更新的商品信息实例</param>
        /// <returns></returns>
        public bool UpdateGoods(Goodsinfo goodsInfo)
        {
            DbParameter[] parms = 
				{
						DbHelper.MakeInParam("@shopid", (DbType)SqlDbType.Int, 4,goodsInfo.Shopid),
						DbHelper.MakeInParam("@categoryid", (DbType)SqlDbType.Int, 4,goodsInfo.Categoryid),
                        DbHelper.MakeInParam("@parentcategorylist", (DbType)SqlDbType.Char, 300,goodsInfo.Parentcategorylist),
                        DbHelper.MakeInParam("@shopcategorylist", (DbType)SqlDbType.Char, 300,goodsInfo.Shopcategorylist),
						DbHelper.MakeInParam("@recommend", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Recommend),
						DbHelper.MakeInParam("@discount", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Discount),
                        DbHelper.MakeInParam("@selleruid", (DbType)SqlDbType.Int, 4,goodsInfo.Selleruid),
						DbHelper.MakeInParam("@seller", (DbType)SqlDbType.NChar, 20,goodsInfo.Seller),
						DbHelper.MakeInParam("@account", (DbType)SqlDbType.NChar, 50,goodsInfo.Account),
						DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 30,goodsInfo.Title),
						DbHelper.MakeInParam("@magic", (DbType)SqlDbType.Int, 4,goodsInfo.Magic),
						DbHelper.MakeInParam("@price", (DbType)SqlDbType.Decimal, 18,goodsInfo.Price),
						DbHelper.MakeInParam("@amount", (DbType)SqlDbType.SmallInt, 2,goodsInfo.Amount),
						DbHelper.MakeInParam("@quality", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Quality),
						DbHelper.MakeInParam("@lid", (DbType)SqlDbType.Int, 4,goodsInfo.Lid),
						DbHelper.MakeInParam("@locus", (DbType)SqlDbType.NChar, 20,goodsInfo.Locus),
						DbHelper.MakeInParam("@transport", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Transport),
			            DbHelper.MakeInParam("@ordinaryfee", (DbType)SqlDbType.Decimal, 18,goodsInfo.Ordinaryfee),
						DbHelper.MakeInParam("@expressfee", (DbType)SqlDbType.Decimal, 18,goodsInfo.Expressfee),
						DbHelper.MakeInParam("@emsfee", (DbType)SqlDbType.Decimal, 18,goodsInfo.Emsfee),
						DbHelper.MakeInParam("@itemtype", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Itemtype),
						DbHelper.MakeInParam("@dateline", (DbType)SqlDbType.DateTime, 8,goodsInfo.Dateline),
						DbHelper.MakeInParam("@expiration", (DbType)SqlDbType.DateTime, 8,goodsInfo.Expiration),
						DbHelper.MakeInParam("@lastbuyer", (DbType)SqlDbType.NChar, 10,goodsInfo.Lastbuyer),
						DbHelper.MakeInParam("@lasttrade", (DbType)SqlDbType.DateTime, 8,goodsInfo.Lasttrade),
						DbHelper.MakeInParam("@lastupdate", (DbType)SqlDbType.DateTime, 8,goodsInfo.Lastupdate),
						DbHelper.MakeInParam("@totalitems", (DbType)SqlDbType.SmallInt, 2,goodsInfo.Totalitems),
						DbHelper.MakeInParam("@tradesum", (DbType)SqlDbType.Decimal, 18,goodsInfo.Tradesum),
						DbHelper.MakeInParam("@closed", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Closed),
						DbHelper.MakeInParam("@aid", (DbType)SqlDbType.Int, 4,goodsInfo.Aid),
                        DbHelper.MakeInParam("@goodspic", (DbType)SqlDbType.NChar, 100,goodsInfo.Goodspic),
						DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 1,goodsInfo.Displayorder),
						DbHelper.MakeInParam("@costprice", (DbType)SqlDbType.Decimal, 18,goodsInfo.Costprice),
						DbHelper.MakeInParam("@invoice", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Invoice),
						DbHelper.MakeInParam("@repair", (DbType)SqlDbType.SmallInt, 2,goodsInfo.Repair),
						DbHelper.MakeInParam("@message", (DbType)SqlDbType.NText, 0,goodsInfo.Message),
						DbHelper.MakeInParam("@otherlink", (DbType)SqlDbType.NChar, 250,goodsInfo.Otherlink),
						DbHelper.MakeInParam("@readperm", (DbType)SqlDbType.Int, 4,goodsInfo.Readperm),
						DbHelper.MakeInParam("@tradetype", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Tradetype),
						DbHelper.MakeInParam("@viewcount", (DbType)SqlDbType.Int, 4,goodsInfo.Viewcount),
						DbHelper.MakeInParam("@smileyoff", (DbType)SqlDbType.Int, 4,goodsInfo.Smileyoff),
						DbHelper.MakeInParam("@bbcodeoff", (DbType)SqlDbType.Int, 4,goodsInfo.Bbcodeoff),
						DbHelper.MakeInParam("@parseurloff", (DbType)SqlDbType.Int, 4,goodsInfo.Parseurloff),
                        DbHelper.MakeInParam("@highlight", (DbType)SqlDbType.VarChar, 500,goodsInfo.Highlight),
                        DbHelper.MakeInParam("@goodsid", (DbType)SqlDbType.Int, 4,goodsInfo.Goodsid)
				};
            string commandText = String.Format("Update [{0}goods]  Set [shopid] = @shopid, [categoryid] = @categoryid, [parentcategorylist] = @parentcategorylist, [shopcategorylist] = @shopcategorylist, [recommend] = @recommend, [discount] = @discount, selleruid = @selleruid, [seller] = @seller, [account] = @account, [title] = @title, [magic] = @magic, [price] = @price, [amount] = @amount, [quality] = @quality, [lid] = @lid, [locus] = @locus, [transport] = @transport, [ordinaryfee] = @ordinaryfee, [expressfee] = @expressfee, [emsfee] = @emsfee, [itemtype] = @itemtype, [dateline] = @dateline, [expiration] = @expiration, [lastbuyer] = @lastbuyer, [lasttrade] = @lasttrade, [lastupdate] = @lastupdate, [totalitems] = @totalitems, [tradesum] = @tradesum, [closed] = @closed, [aid] = @aid, [goodspic] = @goodspic, [displayorder] = @displayorder, [costprice] = @costprice, [invoice] = @invoice, [repair] = @repair, [message] = @message, [otherlink] = @otherlink, [readperm] = @readperm, [tradetype] = @tradetype, [viewcount] = @viewcount, [smileyoff] = @smileyoff, [bbcodeoff] = @bbcodeoff, [highlight] = @highlight  WHERE [goodsid] = @goodsid", BaseConfigs.GetTablePrefix);

            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);

            return true;
        }
コード例 #3
0
ファイル: SqlDataProvider.cs プロジェクト: wenysky/dnt31-lite
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="__goods">要添加的商品信息实例</param>
        /// <returns></returns>
        public int CreateGoods(Goodsinfo goodsInfo)
        {
            DbParameter[] parms = 
				{
						DbHelper.MakeInParam("@shopid", (DbType)SqlDbType.Int, 4,goodsInfo.Shopid),
						DbHelper.MakeInParam("@categoryid", (DbType)SqlDbType.Int, 4,goodsInfo.Categoryid),
                        DbHelper.MakeInParam("@parentcategorylist", (DbType)SqlDbType.Char, 300,goodsInfo.Parentcategorylist),
                        DbHelper.MakeInParam("@shopcategorylist", (DbType)SqlDbType.Char, 300,goodsInfo.Shopcategorylist),
						DbHelper.MakeInParam("@recommend", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Recommend),
						DbHelper.MakeInParam("@discount", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Discount),
                        DbHelper.MakeInParam("@selleruid", (DbType)SqlDbType.Int, 4,goodsInfo.Selleruid),
						DbHelper.MakeInParam("@seller", (DbType)SqlDbType.NChar, 20,goodsInfo.Seller),
						DbHelper.MakeInParam("@account", (DbType)SqlDbType.NChar, 50,goodsInfo.Account),
						DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 30,goodsInfo.Title),
						DbHelper.MakeInParam("@magic", (DbType)SqlDbType.Int, 4,goodsInfo.Magic),
						DbHelper.MakeInParam("@price", (DbType)SqlDbType.Decimal, 18,goodsInfo.Price),
						DbHelper.MakeInParam("@amount", (DbType)SqlDbType.SmallInt, 2,goodsInfo.Amount),
						DbHelper.MakeInParam("@quality", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Quality),
						DbHelper.MakeInParam("@lid", (DbType)SqlDbType.Int, 4,goodsInfo.Lid),
						DbHelper.MakeInParam("@locus", (DbType)SqlDbType.NChar, 20,goodsInfo.Locus),
						DbHelper.MakeInParam("@transport", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Transport),
						DbHelper.MakeInParam("@ordinaryfee", (DbType)SqlDbType.Decimal, 18,goodsInfo.Ordinaryfee),
						DbHelper.MakeInParam("@expressfee", (DbType)SqlDbType.Decimal, 18,goodsInfo.Expressfee),
						DbHelper.MakeInParam("@emsfee", (DbType)SqlDbType.Decimal, 18,goodsInfo.Emsfee),
						DbHelper.MakeInParam("@itemtype", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Itemtype),
						DbHelper.MakeInParam("@dateline", (DbType)SqlDbType.DateTime, 8,goodsInfo.Dateline),
						DbHelper.MakeInParam("@expiration", (DbType)SqlDbType.DateTime, 8,goodsInfo.Expiration),
						DbHelper.MakeInParam("@lastbuyer", (DbType)SqlDbType.NChar, 10,goodsInfo.Lastbuyer),
						DbHelper.MakeInParam("@lasttrade", (DbType)SqlDbType.DateTime, 8,goodsInfo.Lasttrade),
						DbHelper.MakeInParam("@lastupdate", (DbType)SqlDbType.DateTime, 8,goodsInfo.Lastupdate),
						DbHelper.MakeInParam("@totalitems", (DbType)SqlDbType.SmallInt, 2,goodsInfo.Totalitems),
						DbHelper.MakeInParam("@tradesum", (DbType)SqlDbType.Decimal, 18,goodsInfo.Tradesum),
						DbHelper.MakeInParam("@closed", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Closed),
						DbHelper.MakeInParam("@aid", (DbType)SqlDbType.Int, 4,goodsInfo.Aid),
                        DbHelper.MakeInParam("@goodspic", (DbType)SqlDbType.NChar, 100,goodsInfo.Goodspic),
						DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 1,goodsInfo.Displayorder),
						DbHelper.MakeInParam("@costprice", (DbType)SqlDbType.Decimal, 18,goodsInfo.Costprice),
						DbHelper.MakeInParam("@invoice", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Invoice),
						DbHelper.MakeInParam("@repair", (DbType)SqlDbType.SmallInt, 2,goodsInfo.Repair),
						DbHelper.MakeInParam("@message", (DbType)SqlDbType.NText, 0,goodsInfo.Message),
						DbHelper.MakeInParam("@otherlink", (DbType)SqlDbType.NChar, 250,goodsInfo.Otherlink),
						DbHelper.MakeInParam("@readperm", (DbType)SqlDbType.Int, 4,goodsInfo.Readperm),
						DbHelper.MakeInParam("@tradetype", (DbType)SqlDbType.TinyInt, 1,goodsInfo.Tradetype),
                        DbHelper.MakeInParam("@viewcount", (DbType)SqlDbType.Int, 4,goodsInfo.Viewcount),
						DbHelper.MakeInParam("@smileyoff", (DbType)SqlDbType.Int, 4,goodsInfo.Smileyoff),
						DbHelper.MakeInParam("@bbcodeoff", (DbType)SqlDbType.Int, 4,goodsInfo.Bbcodeoff),
						DbHelper.MakeInParam("@parseurloff", (DbType)SqlDbType.Int, 4,goodsInfo.Parseurloff),
                        DbHelper.MakeInParam("@highlight", (DbType)SqlDbType.VarChar, 500,goodsInfo.Highlight)
				};
            string commandText = String.Format("INSERT INTO [{0}goods] ([shopid], [categoryid], [parentcategorylist], [shopcategorylist], [recommend], [discount], [selleruid], [seller], [account], [title], [magic], [price], [amount], [quality], [lid], [locus], [transport], [ordinaryfee], [expressfee], [emsfee], [itemtype], [dateline], [expiration], [lastbuyer], [lasttrade], [lastupdate], [totalitems], [tradesum], [closed], [aid], [goodspic], [displayorder], [costprice], [invoice], [repair], [message], [otherlink], [readperm], [tradetype], [viewcount], [smileyoff], [bbcodeoff], [parseurloff], [highlight] ) VALUES (@shopid, @categoryid, @parentcategorylist,@shopcategorylist, @recommend, @discount, @selleruid, @seller, @account, @title, @magic, @price, @amount, @quality, @lid, @locus, @transport, @ordinaryfee, @expressfee, @emsfee, @itemtype, @dateline, @expiration, @lastbuyer, @lasttrade, @lastupdate, @totalitems, @tradesum, @closed, @aid, @goodspic, @displayorder, @costprice, @invoice, @repair, @message, @otherlink, @readperm, @tradetype, @viewcount, @smileyoff, @bbcodeoff, @parseurloff, @highlight);SELECT SCOPE_IDENTITY()  AS 'goodsid'", BaseConfigs.GetTablePrefix);

            return TypeConverter.ObjectToInt(DbHelper.ExecuteDataset(CommandType.Text, commandText, parms).Tables[0].Rows[0][0], -1);
        }
コード例 #4
0
ファイル: attachment.aspx.cs プロジェクト: wenysky/dnt31-lite
        public void GetGoodsAttachInfo(int attachmentid)
        {
            MallPluginBase mpb = MallPluginProvider.GetInstance();
            if (mpb == null)
            {
                AddErrLine("未安装商城插件");
                return;
            }
            goodsattachmentinfo = mpb.GetGoodsAttachmentsByAid(attachmentid);
            if (goodsattachmentinfo == null)
            {
                AddErrLine("不存在的附件ID");
                return;
            }
            // 获取该商品的信息
            goodsinfo = mpb.GetGoodsInfo(goodsattachmentinfo.Goodsid);
            if (goodsinfo == null)
            {
                AddErrLine("不存在的商品ID");
                return;
            }

            forum = Forums.GetForumInfo(mpb.GetCategoriesFid(goodsinfo.Categoryid));
            pagetitle = Utils.RemoveHtml(forum.Name);

            //添加判断特殊用户的代码
            if (!Forums.AllowViewByUserId(forum.Permuserlist, userid) && !Forums.AllowView(forum.Viewperm, usergroupid))
            {
                AddErrLine("您没有浏览该版块的权限");
                if (userid == -1)
                    needlogin = true;
                return;
            }

            //添加判断特殊用户的代码
            if (!UserAuthority.CheckUsertAttachAuthority(forum, usergroupinfo, userid, ref msg))
            {
                AddErrLine(msg);
                if (userid == -1)
                    needlogin = true;
                return;
            }
            // 检查用户是否拥有足够的阅读权限
            if (goodsattachmentinfo.Readperm > usergroupinfo.Readaccess && goodsattachmentinfo.Uid != userid && !Moderators.IsModer(useradminid, userid, forum.Fid))
            {
                AddErrLine("您的阅读权限不够");
                if (userid == -1)
                    needlogin = true;
                return;
            }
            if (goodsattachmentinfo.Filename.IndexOf("http") < 0 && !File.Exists(Utils.GetMapPath(string.Format(@"{0}upload/{1}", BaseConfigs.GetForumPath, goodsattachmentinfo.Filename))))
            {
                AddErrLine("该附件文件不存在或已被删除");
                return;
            }

            if (goodsattachmentinfo.Filename.IndexOf("http") < 0)
                Utils.ResponseFile(Utils.GetMapPath(string.Format(@"{0}upload/{1}", BaseConfigs.GetForumPath, goodsattachmentinfo.Filename)), Path.GetFileName(goodsattachmentinfo.Attachment), goodsattachmentinfo.Filetype);
            else
                HttpContext.Current.Response.Redirect(goodsattachmentinfo.Filename.Trim());
        }
コード例 #5
0
ファイル: buygoods.cs プロジェクト: wenysky/dnt31-lite
        protected override void ShowPage()
        {
            if (config.Enablemall == 0) //未启用交易服务
            {
                AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!");
                return;
            }

            headerad = "";
            footerad = "";

            // 如果主题ID非数字
            if (goodsid == -1)
            {
                AddErrLine("无效的商品ID");
                return;
            }

            if (userid <= 0)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "login.aspx?reurl=buygoods.aspx?goodsid=" + goodsid);
            }

            goodsinfo = Goods.GetGoodsInfo(goodsid);

            //验证不通过则返回
            if (!IsConditionsValid())
                return;

            goodscategoryinfo = GoodsCategories.GetGoodsCategoryInfoById(goodsinfo.Categoryid);

            if (config.Enablemall == 1) //开启普通模式
            {
                forumid = goodscategoryinfo.Fid;
                forum = Forums.GetForumInfo(forumid);

                if (forum.Password != "" &&
                    Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password"))
                {
                    AddErrLine("本版块被管理员设置了密码");
                    System.Web.HttpContext.Current.Response.Redirect(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1), true);
                    return;
                }                

                if (!Forums.AllowViewByUserId(forum.Permuserlist, userid)) //判断当前用户在当前版块浏览权限
                {
                    if (forum.Viewperm == null || forum.Viewperm == string.Empty)//当板块权限为空时,按照用户组权限
                    {
                        if (usergroupinfo.Allowvisit != 1)
                        {
                            AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有浏览该版块的权限");
                            if (userid == -1)
                            {
                                needlogin = true;
                            }
                            return;
                        }

                        if (useradminid != 1 && (usergroupinfo.Allowvisit != 1 || usergroupinfo.Allowtrade != 1))
                        {
                            AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有进行交易商品的权限");
                            return;
                        }
                    }
                    else//当板块权限不为空,按照板块权限
                    {
                        if (!Forums.AllowView(forum.Viewperm, usergroupid))
                        {
                            AddErrLine("您没有浏览该版块的权限");
                            if (userid == -1)
                            {
                                needlogin = true;
                            }
                            return;
                        }                       
                    }
                }

                if (!Forums.AllowPostByUserID(forum.Permuserlist, userid)) //判断当前用户在当前版块发布商品权限
                {
                    if (forum.Postperm == null || forum.Postperm == string.Empty)//权限设置为空时,根据用户组权限判断
                    {
                        // 验证用户是否有发布商品的权限
                        if (usergroupinfo.Allowtrade != 1)
                        {
                            AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有进行交易商品的权限");
                            return;
                        }
                    }
                    else//权限设置不为空时,根据板块权限判断
                    {
                        if (!Forums.AllowPost(forum.Postperm, usergroupid))
                        {
                            AddErrLine("您没有进行交易商品的权限");
                            return;
                        }
                    }
                }

                forumname = forum.Name;
                pagetitle = goodsinfo.Title;
                forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
            }
            else if (config.Enablemall == 2) //当为高级模式时
            {
                forumid = 0;
            }

            ///得到广告列表
            ///头部
            headerad = Advertisements.GetOneHeaderAd("", forumid);
            footerad = Advertisements.GetOneFooterAd("", forumid);
            doublead = Advertisements.GetDoubleAd("", forumid);
            floatad = Advertisements.GetFloatAd("", forumid);

            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);

            if (useradminid != 0)
            {
                if (config.Enablemall == 1) //开启普通模式
                {
                    ismoder = Moderators.IsModer(useradminid, userid, forumid) ? 1 : 0;
                }
                //得到管理组信息
                admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            }          


            //如果是提交...
            if (ispost)
            {
                //创建商品交易日志
                goodstradelog.Number = DNTRequest.GetInt("number", 0);
                // 商品数不正确
                if (goodstradelog.Number <= 0)
                {
                    AddErrLine("请输入正确的商品数, 请返回修改.");
                    return;
                }
                if (goodsinfo.Amount < goodstradelog.Number)
                {
                    AddErrLine("商品剩余数量不足 (剩余数量为 " + goodsinfo.Amount + ", 而购买数量为 " + goodstradelog.Number + ").");
                    return;
                }

                goodstradelog.Sellerid = goodsinfo.Selleruid;
                goodstradelog.Buyerid = userid;
                if (goodstradelog.Buyerid == goodstradelog.Sellerid)
                {
                    AddErrLine("买卖双方不能是同一用户.");
                    return;
                }
                goodstradelog.Goodsid = goodsinfo.Goodsid;
                goodstradelog.Offline = DNTRequest.GetInt("offline", 0);
                goodstradelog.Orderid = TradeLogs.GetOrderID();
                goodstradelog.Subject = goodsinfo.Title;
                goodstradelog.Price = goodsinfo.Price;
                goodstradelog.Quality = goodsinfo.Quality;
                goodstradelog.Categoryid = goodsinfo.Categoryid;
                goodstradelog.Tax = 0;
                goodstradelog.Locus = goodsinfo.Locus;
                goodstradelog.Seller = goodsinfo.Seller;
                goodstradelog.Selleraccount = goodsinfo.Account;
                goodstradelog.Buyer = username;
                goodstradelog.Buyercontact = DNTRequest.GetString("buyercontact");
                goodstradelog.Buyercredit = 0;
                goodstradelog.Buyermsg = DNTRequest.GetString("buyermsg");
                goodstradelog.Status = (int) TradeStatusEnum.UnStart;
                goodstradelog.Lastupdate = DateTime.Now;
                goodstradelog.Buyername = DNTRequest.GetString("buyername");
                goodstradelog.Buyerzip = DNTRequest.GetString("buyerzip");
                goodstradelog.Buyerphone = DNTRequest.GetString("buyerphone");
                goodstradelog.Buyermobile = DNTRequest.GetString("buyermobile");
                goodstradelog.Transport = DNTRequest.GetInt("transport", 0);
                goodstradelog.Transportpay = goodsinfo.Transport;
                goodstradelog.Transportfee = Convert.ToDecimal(DNTRequest.GetFormFloat("fee", 0).ToString());
                goodstradelog.Tradesum = goodstradelog.Number * goodstradelog.Price + (goodstradelog.Transportpay == 2 ? goodstradelog.Transportfee : 0);
                goodstradelog.Baseprice = goodsinfo.Costprice;
                goodstradelog.Discount = goodsinfo.Discount;
                goodstradelog.Ratestatus = 0;
                goodstradelog.Message = "";

                int tradelogid = TradeLogs.CreateTradeLog(goodstradelog);

                if (tradelogid > 0)
                {
                    string jumpurl = "";
                    if (goodstradelog.Offline == 0)
                        jumpurl = "onlinetrade.aspx?goodstradelogid=" + tradelogid;
                    else
                        jumpurl = "offlinetrade.aspx?goodstradelogid=" + tradelogid;

                    SetUrl(jumpurl);
                    SetMetaRefresh();
                    AddMsgLine("交易单已创建, 现在将转入交易单页面<br />(<a href=\"" + jumpurl + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                }
                else
                {
                    SetUrl("buygoods.aspx?goodsid=" + goodsid);
                    SetMetaRefresh();
                    AddMsgLine("交易单创建错误, 请重新添写交易单<br />(<a href=\"" + "buygoods.aspx?goodsid=" + goodsid + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                }
            }
        }
コード例 #6
0
ファイル: editgoods.cs プロジェクト: wenysky/dnt31-lite
        protected override void ShowPage()
        {
            if (config.Enablemall == 0) //未启用交易模式
            {
                AddErrLine("系统未开启交易模式, 当前页面暂时无法访问!");
                return;
            }

            #region 临时帐号发帖
            //int realuserid = -1;
            //string tempusername = DNTRequest.GetString("tempusername");
            //if (tempusername != "" && tempusername != username)
            //{
            //    string temppassword = DNTRequest.GetString("temppassword");
            //    int question = DNTRequest.GetInt("question", 0);
            //    string answer = DNTRequest.GetString("answer");
            //    realuserid = Users.CheckTempUserInfo(tempusername, temppassword, question, answer);
               
            //    if (realuserid == -1)
            //    {
            //        AddErrLine("临时帐号登录失败,无法继续发帖。");
            //        return;
            //    }
            //    else
            //    {
            //        userid = realuserid;
            //        username = tempusername;
            //        usergroupinfo = UserGroups.GetUserGroupInfo(Users.GetShortUserInfo(userid).Groupid);
            //        usergroupid = usergroupinfo.Groupid;
            //        useradminid = Users.GetShortUserInfo(userid).Adminid;
            //    }
            //}
            #endregion

            canhtmltitle = true;
            firstpagesmilies = Caches.GetSmiliesFirstPageCache();
   
            //内容设置为空;  
            message = "";

            int goodsid = DNTRequest.GetInt("goodsid", 0);
            // 如果商品交易日志不正确
            if (goodsid <= 0)
            {
                AddErrLine("错误的商品ID.");
                return;
            }

            goodsinfo = Goods.GetGoodsInfo(goodsid);
            if (goodsinfo == null || goodsinfo.Goodsid <= 0) 
            {
                AddErrLine("错误的商品ID.");
                return;
            }
                
            goodscategoryinfo = GoodsCategories.GetGoodsCategoryInfoById(goodsinfo.Categoryid);
            if (goodscategoryinfo == null && goodscategoryinfo.Fid <= 0)
            {
                goodscategoryinfo = new Goodscategoryinfo();
                goodscategoryinfo.Categoryid = -1;
            }

            attachmentlist = GoodsAttachments.GetGoodsAttachmentsByGoodsid(goodsinfo.Goodsid);

            message = goodsinfo.Message;

            // 如果商品交易日志不正确
            if (goodsinfo.Selleruid != userid)
            {
                AddErrLine("您不是当前商品的卖家!");
                return;
            }
            allowpostgoods = true;

            if (config.Enablemall == 1) //开启普通模式
            {
                forumid = GoodsCategories.GetCategoriesFid(goodsinfo.Categoryid);
                allowpostgoods = false;
                forumnav = "";
                if (forumid == -1)
                {
                    if (userid == goodsinfo.Selleruid)
                    {
                        forum = new ForumInfo();
                        forum.Attachextensions = "";
                        forum.Password = "";
                        forum.Permuserlist = "";
                    }
                    else
                    {
                        AddErrLine("错误的商品分类ID");
                        return;
                    }
                }
                else
                {
                    forum = Forums.GetForumInfo(forumid);
                    if (forum == null || forum.Layer == 0)
                    {
                        AddErrLine("错误的商品分类ID");
                        return;
                    }
                    if (forum.Istrade <= 0)
                    {
                        AddErrLine("当前版块不允许编辑商品");
                        return;
                    }

                    forumname = forum.Name;
                    pagetitle = Utils.RemoveHtml(forum.Name);
                    forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
                    enabletag = (config.Enabletag & forum.Allowtag) == 1;
                }
            }
            else if (config.Enablemall == 2) //当为高级模式时
            {
                pagetitle = "编辑商品";
                forumnav = "";
                enabletag = true;
                forum = new ForumInfo();
                forum.Allowsmilies = 1;
                forum.Allowbbcode = 1;
            }

            //得到用户可以上传的文件类型
            StringBuilder sbAttachmentTypeSelect = new StringBuilder();
            if (!usergroupinfo.Attachextensions.Trim().Equals(""))
            {
                sbAttachmentTypeSelect.Append("[id] in (");
                sbAttachmentTypeSelect.Append(usergroupinfo.Attachextensions);
                sbAttachmentTypeSelect.Append(")");
            }

            if (config.Enablemall == 1) //开启普通模式
            {
                if (!forum.Attachextensions.Equals(""))
                {
                    if (sbAttachmentTypeSelect.Length > 0)
                    {
                        sbAttachmentTypeSelect.Append(" AND ");
                    }
                    sbAttachmentTypeSelect.Append("[id] in (");
                    sbAttachmentTypeSelect.Append(forum.Attachextensions);
                    sbAttachmentTypeSelect.Append(")");
                }
            }
            attachextensions = Attachments.GetAttachmentTypeArray(sbAttachmentTypeSelect.ToString());
            attachextensionsnosize = Attachments.GetAttachmentTypeString(sbAttachmentTypeSelect.ToString());

            //得到今天允许用户上传的附件总大小(字节)
            int MaxTodaySize = 0;
            if (userid > 0)
            {
                MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid);		//今天已上传大小
            }
            attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小
            parseurloff = 0;
            bbcodeoff = 1;

            if (config.Enablemall == 1) //开启普通模式
            {
                smileyoff = 1 - forum.Allowsmilies;
                if (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1)
                    bbcodeoff = 0;

                allowimg = forum.Allowimgcode;

                if (forum.Password != "" && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid.ToString() + "password"))
                {
                    AddErrLine("本版块被管理员设置了密码");
                    SetBackLink(base.ShowForumAspxRewrite(forumid, 0));
                    return;
                }

                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 + "\" 没有浏览该版块的权限");
                            return;
                        }
                    }
                    else//当板块权限不为空,按照板块权限
                    {
                        if (!Forums.AllowView(forum.Viewperm, usergroupid))
                        {
                            AddErrLine("您没有浏览该商品分类的权限");
                            return;
                        }
                    }
                }

                //当前用户是卖家时
                if (goodsinfo.Selleruid == userid)
                {
                    //当前用户是否有允许下载附件权限
                    if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userid))
                        allowviewattach = true;
                    else
                    {
                        if (forum.Getattachperm == null || forum.Getattachperm == string.Empty)//权限设置为空时,根据用户组权限判断
                        {
                            // 验证用户是否有有允许下载附件权限
                            if (usergroupinfo.Allowgetattach == 1)
                                allowviewattach = true;
                        }
                        else if (Forums.AllowGetAttach(forum.Getattachperm, usergroupid))
                            allowviewattach = true;
                    }

                    //是否有上传附件的权限
                    if (Forums.AllowPostAttachByUserID(forum.Permuserlist, userid))
                        canpostattach = true;
                    else
                    {
                        if (forum.Postattachperm == "")
                        {
                            if (usergroupinfo.Allowpostattach == 1)
                                canpostattach = true;
                        }
                        else
                        {
                            if (Forums.AllowPostAttach(forum.Postattachperm, usergroupid))
                            {
                                canpostattach = true;
                            }
                        }
                    }
                }
            }
            else if (config.Enablemall == 2) //当为高级模式时
            {
                canpostattach = true;
                allowimg = 1;
                smileyoff = 0;
            }

            ShortUserInfo user = Users.GetShortUserInfo(userid);
            if (canpostattach && user != null && apb != null && config.Enablealbum == 1 &&
                (UserGroups.GetUserGroupInfo(user.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0))
            {
                caninsertalbum = true;
                albumlist = apb.GetSpaceAlbumByUserId(userid);
            }
            else
                caninsertalbum = false;

            if (Topics.GetMagicValue(goodsinfo.Magic, MagicType.HtmlTitle) == 1)
            {
                htmltitle = Goods.GetHtmlTitle(goodsinfo.Goodsid).Replace("\"", "\\\"").Replace("'", "\\'");
            }

            
            if (enabletag && Topics.GetMagicValue(goodsinfo.Magic, MagicType.TopicTag) == 1)
            {
                foreach (TagInfo tag in GoodsTags.GetTagsListByGoods(goodsinfo.Goodsid))
                {
                    if (tag.Orderid > -1)
                        goodstags += string.Format(" {0}", tag.Tagname);
                }
                goodstags = goodstags.Trim();
            }


            // 如果是受灌水限制用户, 则判断是否是灌水
            AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            disablepost = (admininfo != null) ? admininfo.Disablepostctrl : 0;
            creditstrans = Scoresets.GetCreditsTrans();
            userextcreditsinfo = Scoresets.GetScoreSet(creditstrans);
            if (userid > 0)
                spaceid = Users.GetShortUserInfo(userid).Spaceid;

            //如果不是提交...
            if (!ispost)
            {
                AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css");
                smilies = Caches.GetSmiliesCache();
                smilietypes = Caches.GetSmilieTypesCache();
                customeditbuttons = Caches.GetCustomEditButtonList();
            }
            else
            {
                SetBackLink(string.Format("postgoods.aspx?forumid={0}&restore=1", forumid));

                string postmessage = DNTRequest.GetString("message");

                ForumUtils.WriteCookie("postmessage", postmessage);

                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                if (DNTRequest.GetString("title").Trim().Equals(""))
                    AddErrLine("商品标题不能为空");
                else if (DNTRequest.GetString("title").IndexOf(" ") != -1)
                    AddErrLine("商品标题不能包含全角空格符");
                else if (DNTRequest.GetString("title").Length > 60)
                    AddErrLine("商品标题最大长度为60个字符,当前为 " + DNTRequest.GetString("title").Length.ToString() + " 个字符");

                if (postmessage.Equals("") || postmessage.Replace(" ", "").Equals(""))
                    AddErrLine("商品内容不能为空");

                if (admininfo != null && admininfo.Disablepostctrl != 1)
                {
                    if (postmessage.Length < config.Minpostsize)
                        AddErrLine("您发表的内容过少, 系统设置要求商品内容不得少于 " + config.Minpostsize + " 字多于 " + config.Maxpostsize + " 字");
                    else if (postmessage.Length > config.Maxpostsize)
                        AddErrLine("您发表的内容过多, 系统设置要求商品内容不得少于 " + config.Minpostsize + " 字多于 " + config.Maxpostsize + " 字");
                }

                if (IsErr())
                    return;

                // 如果用户上传了附件,则检测用户是否有上传附件的权限
                if (ForumUtils.IsPostFile())
                {
                    if (Attachments.GetAttachmentTypeArray(sbAttachmentTypeSelect.ToString()).Trim() == "")
                        AddErrLine("系统不允许上传附件");

                    if (config.Enablemall == 1) //开启普通模式
                    {
                        if (!Forums.AllowPostAttachByUserID(forum.Permuserlist, userid))
                        {
                            if (!Forums.AllowPostAttach(forum.Postattachperm, usergroupid))
                                AddErrLine("您没有在该版块上传附件的权限");
                            else if (usergroupinfo.Allowpostattach != 1)
                                AddErrLine(string.Format("您当前的身份 \"{0}\" 没有上传附件的权限", usergroupinfo.Grouptitle));
                        }
                    }
                }

                if (IsErr())
                    return;

                int iconid = DNTRequest.GetInt("iconid", 0);
                if (iconid > 15 || iconid < 0)
                    iconid = 0;

                string curdatetime = Utils.GetDateTime();

                goodsinfo.Shopid = 0;
                //商品分类原值
                int oldgoodscategoryid = goodsinfo.Categoryid;
                //商品父分类原值
                string oldparentcategorylist = goodsinfo.Parentcategorylist;

                //当商品分类发生变化时
                if (DNTRequest.GetInt("goodscategoryid", 0) != 0 && goodsinfo.Categoryid != DNTRequest.GetInt("goodscategoryid", 0))
                {
                    goodsinfo.Categoryid = DNTRequest.GetInt("goodscategoryid", 0);
                    goodsinfo.Parentcategorylist = GoodsCategories.GetParentCategoryList(goodsinfo.Categoryid);
                }
                
                goodsinfo.Recommend = DNTRequest.GetString("recommend") == "on" ? 1 : 0;
                goodsinfo.Discount = DNTRequest.GetInt("discount", 0);
                goodsinfo.Selleruid = userid;
                goodsinfo.Seller = username;
                goodsinfo.Account = DNTRequest.GetString("account");
                goodsinfo.Price = Convert.ToDecimal(DNTRequest.GetFormFloat("price", 1).ToString());
                goodsinfo.Amount = DNTRequest.GetInt("amount", 0);
                goodsinfo.Quality = DNTRequest.GetInt("quality", 0);
                if(DNTRequest.GetInt("locus_2", 0) != 0)
                {
                    goodsinfo.Lid = DNTRequest.GetInt("locus_2", 0);
                    goodsinfo.Locus = Locations.GetLocusByLID(goodsinfo.Lid);
                }
                goodsinfo.Transport = DNTRequest.GetInt("transport", 0);
                if (goodsinfo.Transport != 0)
                {
                    goodsinfo.Ordinaryfee = Convert.ToDecimal(DNTRequest.GetFormFloat("postage_mail", 0).ToString());
                    goodsinfo.Expressfee = Convert.ToDecimal(DNTRequest.GetFormFloat("postage_express", 0).ToString());
                    goodsinfo.Emsfee = Convert.ToDecimal(DNTRequest.GetFormFloat("postage_ems", 0).ToString());
                }

                goodsinfo.Itemtype = DNTRequest.GetInt("itemtype", 0);

                DateTime dateline;
                switch (DNTRequest.GetInt("_now", 0))
                {
                    case 1: dateline = Convert.ToDateTime(string.Format("{0} {1}:{2}:00", DNTRequest.GetString("_date"), DNTRequest.GetInt("_hour", 0), DNTRequest.GetInt("_minute", 0))); break; //设定
                    case 2: dateline = Convert.ToDateTime("1900-01-01 00:00:00"); break; //返回100年之后的日期作为"暂不设置"
                    default: dateline = DateTime.Now; break; //立即
                }

                goodsinfo.Dateline = dateline;
                goodsinfo.Expiration = Convert.ToDateTime(DNTRequest.GetString("expiration"));
                goodsinfo.Lastbuyer = "";
                goodsinfo.Lastupdate = DateTime.Now;
                goodsinfo.Totalitems = 0;
                goodsinfo.Tradesum = 0;
                goodsinfo.Closed = 0;
                goodsinfo.Aid = 0;

                int displayorder = goodsinfo.Displayorder;
                goodsinfo.Displayorder = DNTRequest.GetString("displayorder") == "on" ? 0 : -3;

                if (config.Enablemall == 1) //当为版块交易帖是时
                {
                    if (forum.Modnewposts == 1 && useradminid != 1)
                    {
                        if (useradminid > 1)
                        {
                            if (disablepost != 1)
                                goodsinfo.Displayorder = -2;
                        }
                        else
                            goodsinfo.Displayorder = -2;
                    }
                }

                goodsinfo.Costprice = Convert.ToDecimal(DNTRequest.GetFormFloat("costprice", 1).ToString());
                goodsinfo.Invoice = DNTRequest.GetInt("invoice", 0);
                goodsinfo.Repair = DNTRequest.GetInt("repair", 0);
                if (useradminid == 1)
                    goodsinfo.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage));
                else
                    goodsinfo.Message = Utils.HtmlEncode(postmessage);
                
                goodsinfo.Otherlink = "";
                int readperm = DNTRequest.GetInt("readperm", 0);
                goodsinfo.Readperm = readperm > 255 ? 255 : readperm;
                goodsinfo.Tradetype = DNTRequest.GetInt("tradetype", 0);

                if (goodsinfo.Tradetype == 1 && Utils.StrIsNullOrEmpty(goodsinfo.Account)) //当为支付宝在线支付方式下,如果"支付宝账户"为空时
                {
                    AddErrLine("请输入支付宝帐号信息。");
                    return;
                }
                
                goodsinfo.Smileyoff = smileyoff;
                if (smileyoff == 0 && forum.Allowsmilies == 1)
                    goodsinfo.Smileyoff = Utils.StrToInt(DNTRequest.GetString("smileyoff"), 0);

                goodsinfo.Bbcodeoff = 1;
                if (usergroupinfo.Allowcusbbcode == 1 && forum.Allowbbcode == 1)
                    goodsinfo.Bbcodeoff = Utils.StrToInt(DNTRequest.GetString("bbcodeoff"), 0);

                goodsinfo.Parseurloff = Utils.StrToInt(DNTRequest.GetString("parseurloff"), 0);

                if (useradminid == 1)
                    goodsinfo.Title = Utils.HtmlEncode(DNTRequest.GetString("title"));
                else
                    goodsinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("title")));
               
                string htmltitle = DNTRequest.GetString("htmltitle").Trim();
                if (htmltitle != string.Empty && Utils.HtmlDecode(htmltitle).Trim() != goodsinfo.Title)
                {
                    goodsinfo.Magic = 11000;
                    //按照  附加位/htmltitle(1位)/magic(3位)/以后扩展(未知位数) 的方式来存储
                    //例: 11001
                }

                //标签(Tag)操作                
                string tags = DNTRequest.GetString("tags").Trim();
                string[] tagsArray = null;
                if (enabletag && tags != string.Empty)
                {
                    tagsArray = Utils.SplitString(tags, " ", true, 2, 10);
                    if (tagsArray.Length > 0)
                    {
                        if (goodsinfo.Magic == 0)
                            goodsinfo.Magic = 10000;

                        goodsinfo.Magic = Utils.StrToInt(goodsinfo.Magic.ToString() + "1", 0);
                    }
                }

                Goods.UpdateGoods(goodsinfo, oldgoodscategoryid, oldparentcategorylist);

                if (displayorder != goodsinfo.Displayorder) //当发生变化时
                {
                    if (displayorder < 0 && goodsinfo.Displayorder > 0) //该商品转为上架
                        DbProvider.GetInstance().UpdateCategoryGoodsCounts(goodsinfo.Categoryid, goodsinfo.Parentcategorylist, 1);
                    else if (displayorder >= 0 && goodsinfo.Displayorder < 0) //该商品转为下架(或进入回收站/待审核状态)
                        DbProvider.GetInstance().UpdateCategoryGoodsCounts(goodsinfo.Categoryid, goodsinfo.Parentcategorylist, -1);
                }

                //保存htmltitle
                if (canhtmltitle && htmltitle != string.Empty && htmltitle != goodsinfo.Title)
                    Goods.WriteHtmlSubjectFile(htmltitle, goodsinfo.Goodsid);

                if (enabletag && tagsArray != null && tagsArray.Length > 0)
                {
                    DbProvider.GetInstance().CreateGoodsTags(string.Join(" ", tagsArray), goodsinfo.Goodsid, userid, curdatetime);
                    GoodsTags.WriteGoodsTagsCacheFile(goodsinfo.Goodsid);
                }

                StringBuilder sb = new StringBuilder();
                sb.Remove(0, sb.Length);

                //编辑帖子时如果进行了批量删除附件
                string delAttId = DNTRequest.GetFormString("deleteaid");
                if (delAttId != string.Empty)
                {
                    if (Utils.IsNumericList(delAttId))//如果要删除的附件ID列表为数字数组
                        GoodsAttachments.DeleteGoodsAttachment(delAttId);
                }
                //编辑帖子时如果进行了更新附件操作
                string updatedAttId = DNTRequest.GetFormString("attachupdatedid");//被更新的附件Id列表
                string updateAttId = DNTRequest.GetFormString("attachupdateid");//所有已上传的附件Id列表
                string[] descriptionArray = DNTRequest.GetFormString("attachupdatedesc").Split(',');//所有已上传的附件的描述
                string[] readpermArray = DNTRequest.GetFormString("attachupdatereadperm").Split(',');//所有已上传得附件的阅读权限

                ArrayList updateAttArrayList = new ArrayList();
                if (updateAttId != string.Empty)
                {
                    foreach (string s in updateAttId.Split(','))
                    {
                        if (!Utils.InArray(s, delAttId, ","))//已上传的附件Id不在被删除的附件Id列表中时
                            updateAttArrayList.Add(s);
                    }
                }

                string[] updateAttArray = (string[])updateAttArrayList.ToArray(typeof(string));

                if (updateAttId != string.Empty)//原来有附件
                {
                    int watermarkstate = config.Watermarkstatus;

                    if (forum.Disablewatermark == 1)
                        watermarkstate = 0;

                    string[] updatedAttArray = updatedAttId.Split(',');

                    string filekey = "attachupdated";

                    //保存新的文件
                    Goodsattachmentinfo[] attArray = Discuz.Mall.MallUtils.SaveRequestFiles(
                                                    goodsinfo.Categoryid, config.Maxattachments + updateAttArray.Length,
                                                    usergroupinfo.Maxsizeperday, usergroupinfo.Maxattachsize, MaxTodaySize,
                                                    attachextensions, watermarkstate, config, filekey);

                    if (Utils.IsNumericArray(updateAttArray))
                    {
                        for (int i = 0; i < updateAttArray.Length; i++) //遍历原来所有附件
                        {
                            string attachmentId = updateAttArray[i];
                            if (Utils.InArray(attachmentId, updatedAttArray)) //附件文件被更新
                            {
                                if (Utils.InArray(attachmentId, delAttId, ","))//附件进行了删除操作, 则不操作此附件,即使其也被更新
                                {
                                    continue;
                                }
                                //更新附件
                                int attachmentUpdatedIndex = GetAttachmentUpdatedIndex(attachmentId, updatedAttArray);//获取此次上传的被更新附件在数组中的索引
                                if (attachmentUpdatedIndex > -1)//附件索引存在
                                {
                                    if (attArray[attachmentUpdatedIndex].Sys_noupload.Equals(string.Empty)) //由此属性为空可以判断上传成功
                                    {
                                        //获取将被更新的附件信息
                                        Goodsattachmentinfo attachmentInfo =
                                            GoodsAttachments.GetGoodsAttachmentsByAid(Utils.StrToInt(updatedAttArray[attachmentUpdatedIndex], 0));
                                        if (attachmentInfo != null)
                                        {
                                            if (attachmentInfo.Filename.Trim().ToLower().IndexOf("http") < 0)
                                            {
                                                //删除原来的文件
                                                File.Delete(Utils.GetMapPath(BaseConfigs.GetForumPath + "upload/" +
                                                                     attachmentInfo.Filename));
                                            }

                                            //记住Aid以便稍后更新
                                            attArray[attachmentUpdatedIndex].Aid = attachmentInfo.Aid;
                                            attArray[attachmentUpdatedIndex].Description = descriptionArray[i];
                                            int att_readperm = Utils.StrToInt(readpermArray[i], 0);
                                            att_readperm = att_readperm > 255 ? 255 : att_readperm;
                                            attArray[attachmentUpdatedIndex].Readperm = att_readperm;
                                            attArray[attachmentUpdatedIndex].Categoryid = attachmentInfo.Categoryid;
                                            attArray[attachmentUpdatedIndex].Goodscount = attachmentInfo.Goodscount;
                                            attArray[attachmentUpdatedIndex].Goodsid = attachmentInfo.Goodsid;

                                            GoodsAttachments.SaveGoodsAttachment(attArray[attachmentUpdatedIndex]);
                                        }
                                    }
                                    else //上传失败的附件,稍后提示
                                    {
                                        sb.Append("<tr><td align=\"left\">");
                                        sb.Append(attArray[attachmentUpdatedIndex].Attachment);
                                        sb.Append("</td>");
                                        sb.Append("<td align=\"left\">");
                                        sb.Append(attArray[attachmentUpdatedIndex].Sys_noupload);
                                        sb.Append("</td></tr>");
                                    }
                                }
                            }
                            else //仅修改了阅读权限和描述等
                            {
                                if (Utils.InArray(updateAttArray[i], delAttId, ","))
                                {
                                    continue;
                                }
                                if ((attachmentlist[i].Readperm.ToString() != readpermArray[i]) ||
                                    (attachmentlist[i].Description.Trim() != descriptionArray[i]))
                                {
                                    int att_readperm = Utils.StrToInt(readpermArray[i], 0);
                                    att_readperm = att_readperm > 255 ? 255 : att_readperm;
                                    GoodsAttachments.SaveGoodsAttachment(Utils.StrToInt(updateAttArray[i], 0), att_readperm,
                                                                 descriptionArray[i]);
                                }
                            }
                        }
                    }
                }

                int watermarkstatus = config.Watermarkstatus;
                if (forum.Disablewatermark == 1)
                {
                    watermarkstatus = 0;
                }
                Goodsattachmentinfo[] attachmentinfo = Discuz.Mall.MallUtils.SaveRequestFiles(forumid, config.Maxattachments, usergroupinfo.Maxsizeperday, usergroupinfo.Maxattachsize, MaxTodaySize, attachextensions, watermarkstatus, config, "postfile");
                if (attachmentinfo != null)
                {
                    if (attachmentinfo.Length > config.Maxattachments)
                    {
                        AddErrLine("系统设置为每个商品附件不得多于" + config.Maxattachments + "个");
                        return;
                    }
                    int errorAttachment = GoodsAttachments.BindAttachment(attachmentinfo, goodsinfo.Goodsid, sb, goodsinfo.Categoryid, userid);
                    int[] aid = GoodsAttachments.CreateAttachments(attachmentinfo);
                    string tempMessage = GoodsAttachments.FilterLocalTags(aid, attachmentinfo, goodsinfo.Message);
                    if (attachmentinfo.Length == (System.Web.HttpContext.Current.Request.Files.Count-2))
                    {
                        goodsinfo.Goodspic = attachmentinfo[0].Filename;
                        goodsinfo.Aid = aid[0];
                    }
                    if (!tempMessage.Equals(goodsinfo.Message))
                        goodsinfo.Message = tempMessage;

                    Goods.UpdateGoods(goodsinfo);

                    UserCredits.UpdateUserExtCreditsByUploadAttachment(userid, aid.Length - errorAttachment);
                }

                //加入相册
                if (config.Enablealbum == 1 && apb != null)
                    sb.Append(apb.CreateAttachment(attachmentinfo, usergroupid, userid, username));

                if (config.Enablemall == 1) //开启普通模式
                {
                    OnlineUsers.UpdateAction(olid, UserAction.PostTopic.ActionID, forumid, forumname, -1, "");                  
                }

                if (sb.Length > 0)
                {
                    SetUrl(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid));
                    SetMetaRefresh(5);
                    SetShowBackLink(true);
                    sb.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发布商品成功,但以下附件上传失败:</nobr></span><br /></td></tr>");
                    sb.Append("</table>");
                    AddMsgLine(sb.ToString());
                }
                else
                {
                    SetShowBackLink(false);
                    if (config.Enablemall == 1 && forum.Modnewposts == 1 && useradminid != 1)
                    {
                        if (useradminid != 1)
                        {
                            if (disablepost == 1)
                            {
                                if (goodsinfo.Displayorder == -3)
                                {
                                    SetUrl(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1));
                                    SetMetaRefresh(5);
                                    AddMsgLine("编辑商品成功, 但未上架. 您可到用户中心进行上架操作!");
                                }
                                else
                                {
                                    SetUrl(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid));
                                    SetMetaRefresh();
                                    AddMsgLine("编辑商品成功, 返回该商品<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">点击这里返回 " + forumname + "</a>)<br />");
                                }
                            }
                            else
                            {
                                SetUrl(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1));
                                SetMetaRefresh();
                                AddMsgLine("编辑商品成功, 但需要经过审核才可以显示. 返回商品列表");
                            }
                        }
                        else
                        {
                            SetUrl(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1));
                            SetMetaRefresh();
                            AddMsgLine("发布商品成功, 返回商品列表");
                        }
                    }
                    else
                    {
                        if (goodsinfo.Displayorder == -3)
                        {
                            SetUrl(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1));
                            SetMetaRefresh(5);
                            AddMsgLine("编辑商品成功, 但未上架. 您可到用户中心进行上架操作!");
                        }
                        else
                        {
                            SetUrl(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid));
                            SetMetaRefresh();
                            AddMsgLine("编辑商品成功, 返回该商品<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">点击这里返回</a>)<br />");
                        }
                    }
                }
                ForumUtils.WriteCookie("postmessage", "");
            }

            topicattachscorefield = 0;
        }
コード例 #7
0
ファイル: Goods.cs プロジェクト: Vinna/DeepInSummer
        /// <summary>
        /// 更新指定商品数据信息
        /// </summary>
        /// <param name="goodsinfo">商品信息</param>
        /// <param name="oldgoodscategoryid">商品分类原值</param>
        /// <param name="oldparentcategorylist">商品父分类原值</param>
        public static void UpdateGoods(Goodsinfo goodsInfo, int oldGoodsCategoryId, string oldParentCategoryList)
        {
            if (goodsInfo.Categoryid != oldGoodsCategoryId && goodsInfo.Categoryid >0)
            {
                DbProvider.GetInstance().UpdateCategoryGoodsCounts(goodsInfo.Categoryid, goodsInfo.Parentcategorylist, 1);
                DbProvider.GetInstance().UpdateCategoryGoodsCounts(oldGoodsCategoryId, oldParentCategoryList, -1);
            }

            DbProvider.GetInstance().UpdateGoods(goodsInfo);
        }
コード例 #8
0
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="GoodsinfoCollection">GoodsinfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="GoodsinfoCollection">GoodsinfoCollection</see> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 public int IndexOf(Goodsinfo value)
 {
     return(this.List.IndexOf(value));
 }
コード例 #9
0
        public void Remove(Goodsinfo value) 
		{
			List.Remove(value);
		}
コード例 #10
0
        public int Add(Goodsinfo value) 
		{
			return this.List.Add(value);
		}
コード例 #11
0
ファイル: postgoods.cs プロジェクト: ZeroneBit/dnt3_src
        protected override void ShowPage()
        {
            if (config.Enablemall == 0) //未启用交易模式
            {
                AddErrLine("系统未开启交易模式, 当前页面暂时无法访问!");
                return;
            }
            
            #region 临时帐号发帖
            int realuserid = -1;
            string tempusername = DNTRequest.GetString("tempusername");
            if (tempusername != "" && tempusername != username)
            {
                string temppassword = DNTRequest.GetString("temppassword");
                int question = DNTRequest.GetInt("question", 0);
                string answer = DNTRequest.GetString("answer");
                realuserid = Users.CheckTempUserInfo(tempusername, temppassword, question, answer);
                if (realuserid == -1)
                {
                    AddErrLine("临时帐号登录失败,无法继续发帖。");
                    return;
                }
                else
                {
                    userid = realuserid;
                    username = tempusername;
                    usergroupinfo = UserGroups.GetUserGroupInfo(Users.GetShortUserInfo(userid).Groupid);
                    usergroupid = usergroupinfo.Groupid;
                    useradminid = Users.GetShortUserInfo(userid).Adminid;
                }
            }
            #endregion

            #region 获取分类对象信息
            int categoryid = DNTRequest.GetInt("categoryid", -1);

            //如果是提交...
            if (ispost)
                categoryid = DNTRequest.GetInt("goodscategoryid", -1);

            if (categoryid > 0)
                goodscategoryinfo = GoodsCategories.GetGoodsCategoryInfoById(categoryid);

            if (goodscategoryinfo == null)
            { 
                goodscategoryinfo = new Goodscategoryinfo();
                goodscategoryinfo.Categoryid = -1;
            }

            if (goodscategoryinfo.Fid <=0)
            {
                allowpostgoods = false;
                forumnav = "";
                AddErrLine("错误的商品分类ID");                
                return;
            } 
            #endregion

            canhtmltitle = config.Htmltitle == 1 && Utils.InArray(usergroupid.ToString(), config.Htmltitleusergroup);
            firstpagesmilies = Caches.GetSmiliesFirstPageCache();

            //内容设置为空;  
            message = "";

            if (config.Enablemall == 1) //开启普通模式
            {
                forumid = GoodsCategories.GetCategoriesFid(categoryid);
                forumnav = "";
                if (forumid == -1)
                {
                    allowpostgoods = false;
                    AddErrLine("错误的商品分类ID");
                    return;
                }
                else
                {
                    forum = Forums.GetForumInfo(forumid);
                    if (forum == null || forum.Layer == 0)
                    {
                        allowpostgoods = false;
                        AddErrLine("错误的商品分类ID");                        
                        return;
                    }

                    if (forum.Istrade <= 0)
                    {
                        allowpostgoods = false;
                        AddErrLine("当前版块不允许发布商品");
                        return;
                    }

                    forumname = forum.Name;
                    pagetitle = Utils.RemoveHtml(forum.Name);
                    forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
                    enabletag = (config.Enabletag & forum.Allowtag) == 1;
                }
            }
            else if(config.Enablemall == 2) //当为高级模式时
            {
                pagetitle = "发布商品";
                forumnav = "";
                enabletag = true;
                forum = new ForumInfo();
                forum.Allowsmilies = 1;
                forum.Allowbbcode = 1;
            }

            //得到用户可以上传的文件类型
            StringBuilder sbAttachmentTypeSelect = new StringBuilder();
            if (!usergroupinfo.Attachextensions.Trim().Equals(""))
            {
                sbAttachmentTypeSelect.Append("[id] in (");
                sbAttachmentTypeSelect.Append(usergroupinfo.Attachextensions);
                sbAttachmentTypeSelect.Append(")");
            }
            if (config.Enablemall == 1) //开启普通模式
            {
                if (!forum.Attachextensions.Equals(""))
                {
                    if (sbAttachmentTypeSelect.Length > 0)
                    {
                        sbAttachmentTypeSelect.Append(" AND ");
                    }
                    sbAttachmentTypeSelect.Append("[id] in (");
                    sbAttachmentTypeSelect.Append(forum.Attachextensions);
                    sbAttachmentTypeSelect.Append(")");
                }
            }
            attachextensions = Attachments.GetAttachmentTypeArray(sbAttachmentTypeSelect.ToString());
            attachextensionsnosize = Attachments.GetAttachmentTypeString(sbAttachmentTypeSelect.ToString());

            //得到今天允许用户上传的附件总大小(字节)
            int MaxTodaySize = 0;
            if (userid > 0)
            {
                MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid);		//今天已上传大小
            }
            attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小

            parseurloff = 0;
            bbcodeoff = 1;

            if (config.Enablemall == 1) //开启普通模式
            {
                smileyoff = 1 - forum.Allowsmilies;
                allowimg = forum.Allowimgcode;

                if (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1)
                    bbcodeoff = 0;
            }


            // 如果当前用户非管理员并且论坛设定了禁止发布商品时间段,当前时间如果在其中的一个时间段内,不允许用户发布商品
            if (useradminid != 1 && usergroupinfo.Disableperiodctrl != 1)
            {
                string visittime = "";
                if (Scoresets.BetweenTime(config.Postbanperiods, out visittime))
                {
                    AddErrLine("在此时间段( " + visittime + " )内用户不可以发布商品");
                    return;
                }
            }

            if (config.Enablemall == 1) //开启普通模式
            {
                if (forum.Password != "" && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid.ToString() + "password"))
                {
                    AddErrLine("本版块被管理员设置了密码");
                    SetBackLink(base.ShowForumAspxRewrite(forumid, 0));
                    return;
                }

                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 + "\" 没有发布商品的权限");
                            return;
                        }
                    }
                    else//当板块权限不为空,按照板块权限
                    {
                        if (!Forums.AllowView(forum.Viewperm, usergroupid))
                        {
                            AddErrLine("您没有发布商品的权限");
                            return;
                        }
                    }
                }

                if (!Forums.AllowPostByUserID(forum.Permuserlist, userid)) //判断当前用户在当前版块发布商品权限
                {
                    if (forum.Postperm == null || forum.Postperm == string.Empty)//权限设置为空时,根据用户组权限判断
                    {
                        // 验证用户是否有发布商品的权限
                        if (useradminid != 1 && usergroupinfo.Allowtrade != 1)
                        {
                            AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有发布商品的权限");
                            return;
                        }
                    }
                    else//权限设置不为空时,根据板块权限判断
                    {
                        if (!Forums.AllowPost(forum.Postperm, usergroupid))
                        {
                            AddErrLine("您没有发布商品的权限");
                            return;
                        }
                    }
                }

                //是否有上传附件的权限
                if (Forums.AllowPostAttachByUserID(forum.Permuserlist, userid))
                    canpostattach = true;
                else
                {
                    if (forum.Postattachperm == "")
                    {
                        if (usergroupinfo.Allowpostattach == 1)
                            canpostattach = true;
                    }
                    else
                    {
                        if (Forums.AllowPostAttach(forum.Postattachperm, usergroupid))
                            canpostattach = true;
                    }
                }
            }
            else if (config.Enablemall == 2) //当为高级模式时
            {
                canpostattach = true;
                allowimg = 1;
                smileyoff = 0;
            }


            ShortUserInfo user = Users.GetShortUserInfo(userid);
            if (canpostattach && user != null && apb != null && config.Enablealbum == 1 &&
                (UserGroups.GetUserGroupInfo(user.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0))
            {
                caninsertalbum = true;
                albumlist = apb.GetSpaceAlbumByUserId(userid);
            }
            else
                caninsertalbum = false;

            // 如果是受灌水限制用户, 则判断是否是灌水
            AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            disablepost = 0;
            if (admininfo != null)
                disablepost = admininfo.Disablepostctrl;

            if (admininfo == null || admininfo.Disablepostctrl != 1)
            {
                int Interval = Utils.StrDateDiffSeconds(lastposttime, config.Postinterval);
                if (Interval < 0)
                {
                    AddErrLine("系统规定发布商品间隔为" + config.Postinterval.ToString() + "秒, 您还需要等待 " + (Interval * -1).ToString() + " 秒");
                    return;
                }
                else if (userid != -1)
                {
                    ShortUserInfo shortUserInfo = Discuz.Data.Users.GetShortUserInfo(userid);
                    string joindate = (shortUserInfo != null) ? shortUserInfo.Joindate : "";
                    if (joindate == "")
                    {
                        AddErrLine("您的用户资料出现错误");
                        return;
                    }

                    Interval = Utils.StrDateDiffMinutes(joindate, config.Newbiespan);
                    if (Interval < 0)
                    {
                        AddErrLine("系统规定新注册用户必须要在" + config.Newbiespan.ToString() + "分钟后才可以发布商品, 您还需要等待 " + (Interval * -1).ToString() + " 分");
                        return;
                    }
                }
            }

            creditstrans = Scoresets.GetCreditsTrans();
            userextcreditsinfo = Scoresets.GetScoreSet(creditstrans);

            if (userid > 0)
                spaceid = Users.GetShortUserInfo(userid).Spaceid;

            //如果不是提交...
            if (!ispost)
            {
                AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css");
                smilies = Caches.GetSmiliesCache();
                smilietypes = Caches.GetSmilieTypesCache();
                customeditbuttons = Caches.GetCustomEditButtonList();
            }
            else
            {
                SetBackLink(string.Format("postgoods.aspx?categoryid={0}&restore=1", categoryid));

                string postmessage = DNTRequest.GetString("message");

                ForumUtils.WriteCookie("postmessage", postmessage);

                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                if (DNTRequest.GetString("title").Trim().Equals(""))
                    AddErrLine("商品标题不能为空");
                else if (DNTRequest.GetString("title").IndexOf(" ") != -1)
                    AddErrLine("商品标题不能包含全角空格符");
                else if (DNTRequest.GetString("title").Length > 60)
                    AddErrLine("商品标题最大长度为60个字符,当前为 " + DNTRequest.GetString("title").Length + " 个字符");

                if (postmessage.Equals("") || postmessage.Replace(" ", "").Equals(""))
                    AddErrLine("商品内容不能为空");

                if (admininfo != null && admininfo.Disablepostctrl != 1)
                {
                    if (postmessage.Length < config.Minpostsize)
                        AddErrLine("您发表的内容过少, 系统设置要求商品内容不得少于 " + config.Minpostsize + " 字多于 " + config.Maxpostsize + " 字");
                    else if (postmessage.Length > config.Maxpostsize)
                        AddErrLine("您发表的内容过多, 系统设置要求商品内容不得少于 " + config.Minpostsize + " 字多于 " + config.Maxpostsize + " 字");
                }

                //新用户广告强力屏蔽检查
                if (config.Disablepostad == 1 || userid == -1)  //如果开启新用户广告强力屏蔽检查或是游客
                {
                    if (userid == -1 || (config.Disablepostadpostcount != 0 && user.Posts <= config.Disablepostadpostcount) ||
                        (config.Disablepostadregminute != 0 && DateTime.Now.AddMinutes(-config.Disablepostadregminute) <= Convert.ToDateTime(user.Joindate)))
                    {
                        foreach (string regular in config.Disablepostadregular.Replace("\r", "").Split('\n'))
                        {
                            if (Posts.IsAD(regular, DNTRequest.GetString("title"), postmessage))
                            {
                                AddErrLine("发布商品失败,商品内容中似乎有广告信息,请检查标题和内容,如有疑问请与管理员联系");
                                return;
                            }
                        }
                    }
                }

                if (IsErr())
                    return;

                // 如果用户上传了附件,则检测用户是否有上传附件的权限
                if (ForumUtils.IsPostFile())
                {
                    if (Attachments.GetAttachmentTypeArray(sbAttachmentTypeSelect.ToString()).Trim() == "")
                        AddErrLine("系统不允许上传附件");

                    if (config.Enablemall == 1) //开启普通模式
                    {
                        if (!Forums.AllowPostAttachByUserID(forum.Permuserlist, userid))
                        {
                            if (!Forums.AllowPostAttach(forum.Postattachperm, usergroupid))
                                AddErrLine("您没有在该版块上传附件的权限");
                            else if (usergroupinfo.Allowpostattach != 1)
                                AddErrLine(string.Format("您当前的身份 \"{0}\" 没有上传附件的权限", usergroupinfo.Grouptitle));
                        }
                    }
                }

                if (IsErr())
                    return;

                int iconid = DNTRequest.GetInt("iconid", 0);
                if (iconid > 15 || iconid < 0)
                    iconid = 0;

                string curdatetime = Utils.GetDateTime();

                Goodsinfo goodsinfo = new Goodsinfo();

                //当在高级模式下则绑定相应店铺信息
                if (config.Enablemall == 2)
                {
                    Shopinfo shopinfo = Shops.GetShopByUserId(user.Uid);
                    if (shopinfo != null)
                        goodsinfo.Shopid = shopinfo.Shopid;
                }
                goodsinfo.Categoryid = goodscategoryinfo.Categoryid;
                goodsinfo.Parentcategorylist = goodscategoryinfo.Parentidlist;
                goodsinfo.Recommend = DNTRequest.GetString("recommend") == "on" ? 1 : 0;
                goodsinfo.Discount = DNTRequest.GetInt("discount", 0);
                goodsinfo.Selleruid = userid;
                goodsinfo.Seller = username;
                goodsinfo.Account = DNTRequest.GetString("account");
                goodsinfo.Price = Convert.ToDecimal(DNTRequest.GetFormFloat("price", 1).ToString());
                goodsinfo.Amount = DNTRequest.GetInt("amount", 0);
                goodsinfo.Quality = DNTRequest.GetInt("quality", 0);
                goodsinfo.Lid = DNTRequest.GetInt("locus_2", 0);
                goodsinfo.Locus = Locations.GetLocusByLID(goodsinfo.Lid);
                goodsinfo.Transport = DNTRequest.GetInt("transport", 0);
                if (goodsinfo.Transport != 0)
                {
                    goodsinfo.Ordinaryfee = Convert.ToDecimal(DNTRequest.GetFormFloat("postage_mail", 0).ToString());
                    goodsinfo.Expressfee = Convert.ToDecimal(DNTRequest.GetFormFloat("postage_express", 0).ToString());
                    goodsinfo.Emsfee = Convert.ToDecimal(DNTRequest.GetFormFloat("postage_ems", 0).ToString());
                }
                goodsinfo.Itemtype = DNTRequest.GetInt("itemtype", 0);

                DateTime dateline;
                switch (DNTRequest.GetInt("_now", 0))
                {
                    case 1: dateline = Convert.ToDateTime(string.Format("{0} {1}:{2}:00", DNTRequest.GetString("_date"), DNTRequest.GetInt("_hour", 0), DNTRequest.GetInt("_minute", 0))); break; //设定
                    case 2: dateline = Convert.ToDateTime("1900-01-01 00:00:00"); break; //返回100年之后的日期作为"暂不设置"
                    default: dateline = DateTime.Now; break; //立即
                }

                goodsinfo.Dateline = dateline;
                goodsinfo.Expiration = Convert.ToDateTime(DNTRequest.GetString("expiration"));
                goodsinfo.Lastbuyer = "";
                goodsinfo.Lasttrade = Convert.ToDateTime("1900-01-01 00:00:00");
                goodsinfo.Lastupdate = Convert.ToDateTime(Utils.GetDateTime());
                goodsinfo.Totalitems = 0;
                goodsinfo.Tradesum = 0;
                goodsinfo.Closed = 0;
                goodsinfo.Aid = 0;
                goodsinfo.Costprice = Convert.ToDecimal(DNTRequest.GetFormFloat("costprice", 1).ToString());
                goodsinfo.Invoice = DNTRequest.GetInt("invoice", 0);
                goodsinfo.Repair = DNTRequest.GetInt("repair", 0);
                if (useradminid == 1)
                    goodsinfo.Message = Utils.HtmlEncode(postmessage);
                else
                    goodsinfo.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage));
                                
                goodsinfo.Otherlink = "";
                int readperm = DNTRequest.GetInt("readperm", 0);
                goodsinfo.Readperm = readperm > 255 ? 255 : readperm;
                goodsinfo.Tradetype = DNTRequest.GetInt("tradetype", 0);

                if (goodsinfo.Tradetype == 1 && Utils.StrIsNullOrEmpty(goodsinfo.Account)) //当为支付宝在线支付方式下,如果"支付宝账户"为空时
                {
                    AddErrLine("请输入支付宝帐号信息。");
                    return;
                }

                goodsinfo.Viewcount = 0;
                goodsinfo.Displayorder = DNTRequest.GetString("displayorder") == "on" ? 0 : -3;

                if (config.Enablemall == 1) //当为版块交易帖是时
                {
                    if (forum.Modnewposts == 1 && useradminid != 1)
                    {
                        if (useradminid > 1)
                        {
                            if (disablepost != 1)
                            {
                                goodsinfo.Displayorder = -2;
                                disablepost = 0;
                            }
                        }
                        else
                        {
                            goodsinfo.Displayorder = -2;
                            disablepost = 0;
                        }
                    }
                }

                goodsinfo.Smileyoff = smileyoff;
                if (smileyoff == 0 && forum.Allowsmilies == 1)
                    goodsinfo.Smileyoff = Utils.StrToInt(DNTRequest.GetString("smileyoff"), 0);

                goodsinfo.Bbcodeoff = 1;
                if (usergroupinfo.Allowcusbbcode == 1 && forum.Allowbbcode == 1)
                    goodsinfo.Bbcodeoff = Utils.StrToInt(DNTRequest.GetString("bbcodeoff"), 0);

                goodsinfo.Parseurloff = Utils.StrToInt(DNTRequest.GetString("parseurloff"), 0);

                if (useradminid == 1)
                    goodsinfo.Title = Utils.HtmlEncode(DNTRequest.GetString("title"));
                else
                    goodsinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("title")));

                string htmltitle = DNTRequest.GetString("htmltitle").Trim();
                if (htmltitle != string.Empty && Utils.HtmlDecode(htmltitle).Trim() != goodsinfo.Title)
                {
                    goodsinfo.Magic = 11000;
                    //按照  附加位/htmltitle(1位)/magic(3位)/以后扩展(未知位数) 的方式来存储
                    //例: 11001
                }

                //标签(Tag)操作                
                string tags = DNTRequest.GetString("tags").Trim();
                string[] tagsArray = null;
                if (enabletag && tags != string.Empty)
                {
                    tagsArray = Utils.SplitString(tags, " ", true, 2, 10);
                    if (tagsArray.Length > 0)
                    {
                        if (goodsinfo.Magic == 0)
                            goodsinfo.Magic = 10000;

                        goodsinfo.Magic = Utils.StrToInt(goodsinfo.Magic.ToString() + "1", 0);
                    }
                }

                goodsinfo.Goodsid = Goods.CreateGoods(goodsinfo);
                //保存htmltitle
                if (canhtmltitle && htmltitle != string.Empty && htmltitle != goodsinfo.Title)
                    Goods.WriteHtmlSubjectFile(htmltitle, goodsinfo.Goodsid);

                if (enabletag && tagsArray != null && tagsArray.Length > 0)
                {
                    DbProvider.GetInstance().CreateGoodsTags(string.Join(" ", tagsArray), goodsinfo.Goodsid, userid, curdatetime);
                    GoodsTags.WriteGoodsTagsCacheFile(goodsinfo.Goodsid);
                }

                StringBuilder sb = new StringBuilder();
                sb.Remove(0, sb.Length);

                int watermarkstatus = (forum.Disablewatermark == 1) ? 0 : config.Watermarkstatus;
       
                Goodsattachmentinfo[] attachmentinfo = Discuz.Mall.MallUtils.SaveRequestFiles(categoryid, config.Maxattachments, usergroupinfo.Maxsizeperday, usergroupinfo.Maxattachsize, MaxTodaySize, attachextensions, watermarkstatus, config, "postfile");
                if (attachmentinfo != null)
                {
                    if (attachmentinfo.Length > config.Maxattachments)
                    {
                        AddErrLine("系统设置为每个商品附件不得多于" + config.Maxattachments + "个");
                        return;
                    }
                    int errorAttachment = GoodsAttachments.BindAttachment(attachmentinfo, goodsinfo.Goodsid, sb, goodsinfo.Categoryid, userid);
                    int[] aid = GoodsAttachments.CreateAttachments(attachmentinfo);
                    string tempMessage = GoodsAttachments.FilterLocalTags(aid, attachmentinfo, goodsinfo.Message);

                    goodsinfo.Goodspic = (attachmentinfo.Length > 0) ? attachmentinfo[0].Filename : "";
                    if (!tempMessage.Equals(goodsinfo.Message))
                    {
                        goodsinfo.Message = tempMessage;
                        goodsinfo.Aid = aid[0];
                    }
                    Goods.UpdateGoods(goodsinfo);

                    UserCredits.UpdateUserCreditsByUploadAttachment(userid, aid.Length - errorAttachment);
                }

                //加入相册
                #region 相册
                if (config.Enablealbum == 1 && apb != null)
                {
                    sb.Append(apb.CreateAttachment(attachmentinfo, usergroupid, userid, username));
                }
                #endregion
                if (config.Enablemall == 1) //开启普通模式
                {
                    OnlineUsers.UpdateAction(olid, UserAction.PostTopic.ActionID, forumid, forumname, -1, "", config.Onlinetimeout);
                    // 更新在线表中的用户最后发布商品时间
                    OnlineUsers.UpdatePostTime(olid);
                }

                if (sb.Length > 0)
                {
                    SetShowBackLink(true);

                    sb.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发布商品成功,但以下附件上传失败:</nobr></span><br /></td></tr>");
                    sb.Append("</table>");
                    SetUrlAndMsgLine(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid), sb.ToString());
                }
                else
                {
                    SetShowBackLink(false);

                    if (config.Enablemall == 1 && forum.Modnewposts == 1 && useradminid != 1)
                    {
                        if (useradminid != 1)
                        {
                            if (disablepost == 1)
                            {
                                if (goodsinfo.Displayorder == -3)
                                {
                                    SetUrlAndMsgLine(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1), "发布商品成功, 但未上架. 您可到用户中心进行上架操作!");
                                }
                                else
                                {
                                    SetUrlAndMsgLine(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid), 
                                        "发布商品成功, 返回该商品<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">点击这里返回 " + forumname + "</a>)<br />");
                                }
                            }
                            else
                            {
                                SetUrlAndMsgLine(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1), "发布商品成功, 但需要经过审核才可以显示. 返回商品列表");
                            }
                        }
                        else
                        {
                            SetUrlAndMsgLine(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1), "发布商品成功, 返回商品列表");
                        }
                    }
                    else
                    {
                        if (goodsinfo.Displayorder == -3)
                        {
                            SetUrlAndMsgLine(base.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1), "发布商品成功, 但未上架. 您可到用户中心进行上架操作!");
                        }
                        else
                        {
                            SetUrlAndMsgLine(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid),
                                "发布商品成功, 返回该商品<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">点击这里返回</a>)<br />");
                        }
                    }
                }

                ForumUtils.WriteCookie("postmessage", "");
            }

            topicattachscorefield = 0;
        }
コード例 #12
0
 public void Insert(int index, Goodsinfo value)
 {
     List.Insert(index, value);
 }
コード例 #13
0
ファイル: Goods.cs プロジェクト: Vinna/DeepInSummer
            /// <summary>
            /// 获得商品信息(DTO)
            /// </summary>
            /// <param name="idatareader">要转换的数据</param>
            /// <returns>返回商品信息</returns>
            public static Goodsinfo GetGoodsInfo(IDataReader reader)
            {
                if (reader.Read())
                {
                    Goodsinfo goodsinfo = new Goodsinfo();
                    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 = Convert.ToInt16(reader["recommend"]);
                    goodsinfo.Discount = Convert.ToInt16(reader["discount"]);
                    goodsinfo.Selleruid = TypeConverter.ObjectToInt(reader["selleruid"]);
                    goodsinfo.Seller = reader["seller"].ToString().Trim();
                    goodsinfo.Account = reader["account"].ToString().Trim();
                    goodsinfo.Magic = TypeConverter.ObjectToInt(reader["magic"]);
                    goodsinfo.Price = Convert.ToDecimal(reader["price"].ToString());
                    goodsinfo.Amount = Convert.ToInt16(reader["amount"].ToString());
                    goodsinfo.Quality = Convert.ToInt16(reader["quality"].ToString());
                    goodsinfo.Lid = TypeConverter.ObjectToInt(reader["lid"]);
                    goodsinfo.Locus = reader["locus"].ToString().Trim();
                    goodsinfo.Transport = Convert.ToInt16(reader["transport"].ToString());
                    goodsinfo.Ordinaryfee = Convert.ToDecimal(reader["ordinaryfee"].ToString());
                    goodsinfo.Expressfee = Convert.ToDecimal(reader["expressfee"].ToString());
                    goodsinfo.Emsfee = Convert.ToDecimal(reader["emsfee"].ToString());
                    goodsinfo.Itemtype = Convert.ToInt16(reader["itemtype"].ToString());
                    goodsinfo.Dateline = Convert.ToDateTime(reader["dateline"].ToString());
                    goodsinfo.Expiration = Convert.ToDateTime(reader["expiration"].ToString());
                    goodsinfo.Lastbuyer = reader["lastbuyer"].ToString().Trim();
                    goodsinfo.Lasttrade = Convert.ToDateTime(reader["lasttrade"].ToString());
                    goodsinfo.Lastupdate = Convert.ToDateTime(reader["lastupdate"].ToString());
                    goodsinfo.Totalitems = Convert.ToInt16(reader["totalitems"].ToString());
                    goodsinfo.Tradesum = Convert.ToDecimal(reader["tradesum"].ToString());
                    goodsinfo.Closed = Convert.ToInt16(reader["closed"].ToString());
                    goodsinfo.Aid = TypeConverter.ObjectToInt(reader["aid"]);
                    goodsinfo.Goodspic = reader["goodspic"].ToString().Trim();
                    goodsinfo.Displayorder = Convert.ToInt16(reader["displayorder"].ToString());
                    goodsinfo.Costprice = Convert.ToDecimal(reader["costprice"].ToString());
                    goodsinfo.Invoice = Convert.ToInt16(reader["invoice"].ToString());
                    goodsinfo.Repair = Convert.ToInt16(reader["repair"].ToString());
                    goodsinfo.Message = reader["message"].ToString().Trim();
                    goodsinfo.Otherlink = reader["otherlink"].ToString().Trim();
                    goodsinfo.Readperm = TypeConverter.ObjectToInt(reader["readperm"]);
                    goodsinfo.Tradetype = Convert.ToInt16(reader["tradetype"].ToString());
                    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);

                    reader.Close();
                    return goodsinfo;
                }
                return null;
            }
コード例 #14
0
ファイル: Goods.cs プロジェクト: Vinna/DeepInSummer
            /// <summary>
            /// 获得商品信息(DTO)
            /// </summary>
            /// <param name="dt">要转换的数据表</param>
            /// <returns>返回商品信息</returns>
            public static Goodsinfo[] GetGoodsInfoArray(DataTable dt)
            {
                if (dt == null || dt.Rows.Count == 0)
                    return null;

                Goodsinfo[] goodsinfoarray = new Goodsinfo[dt.Rows.Count];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    goodsinfoarray[i] = new Goodsinfo();
                    goodsinfoarray[i].Goodsid = TypeConverter.ObjectToInt(dt.Rows[i]["goodsid"]);
                    goodsinfoarray[i].Shopid = TypeConverter.ObjectToInt(dt.Rows[i]["shopid"]);
                    goodsinfoarray[i].Parentcategorylist = dt.Rows[i]["parentcategorylist"].ToString();
                    goodsinfoarray[i].Shopcategorylist = dt.Rows[i]["shopcategorylist"].ToString();
                    goodsinfoarray[i].Categoryid = TypeConverter.ObjectToInt(dt.Rows[i]["categoryid"]);
                    goodsinfoarray[i].Recommend = TypeConverter.ObjectToInt(dt.Rows[i]["recommend"]);
                    goodsinfoarray[i].Discount = TypeConverter.ObjectToInt(dt.Rows[i]["discount"]);
                    goodsinfoarray[i].Selleruid = TypeConverter.ObjectToInt(dt.Rows[i]["selleruid"]);
                    goodsinfoarray[i].Seller = dt.Rows[i]["seller"].ToString();
                    goodsinfoarray[i].Account = dt.Rows[i]["account"].ToString();
                    goodsinfoarray[i].Magic = TypeConverter.ObjectToInt(dt.Rows[i]["magic"]);
                    goodsinfoarray[i].Price = Convert.ToDecimal(dt.Rows[i]["price"].ToString());
                    goodsinfoarray[i].Amount = TypeConverter.ObjectToInt(dt.Rows[i]["amount"]);
                    goodsinfoarray[i].Quality = TypeConverter.ObjectToInt(dt.Rows[i]["quality"]);
                    goodsinfoarray[i].Lid = TypeConverter.ObjectToInt(dt.Rows[i]["lid"]);
                    goodsinfoarray[i].Locus = dt.Rows[i]["locus"].ToString();
                    goodsinfoarray[i].Transport = TypeConverter.ObjectToInt(dt.Rows[i]["transport"]);
                    goodsinfoarray[i].Ordinaryfee = Convert.ToDecimal(dt.Rows[i]["ordinaryfee"].ToString());
                    goodsinfoarray[i].Expressfee = Convert.ToDecimal(dt.Rows[i]["expressfee"].ToString());
                    goodsinfoarray[i].Emsfee = Convert.ToDecimal(dt.Rows[i]["emsfee"].ToString());
                    goodsinfoarray[i].Itemtype = TypeConverter.ObjectToInt(dt.Rows[i]["itemtype"]);
                    goodsinfoarray[i].Dateline = Convert.ToDateTime(dt.Rows[i]["dateline"].ToString());
                    goodsinfoarray[i].Expiration = Convert.ToDateTime(dt.Rows[i]["expiration"].ToString());
                    goodsinfoarray[i].Lastbuyer = dt.Rows[i]["lastbuyer"].ToString();
                    goodsinfoarray[i].Lasttrade = Convert.ToDateTime(dt.Rows[i]["lasttrade"].ToString());
                    goodsinfoarray[i].Lastupdate = Convert.ToDateTime(dt.Rows[i]["lastupdate"].ToString());
                    goodsinfoarray[i].Totalitems = TypeConverter.ObjectToInt(dt.Rows[i]["totalitems"]);
                    goodsinfoarray[i].Tradesum = Convert.ToDecimal(dt.Rows[i]["tradesum"].ToString());
                    goodsinfoarray[i].Closed = TypeConverter.ObjectToInt(dt.Rows[i]["closed"]);
                    goodsinfoarray[i].Aid = TypeConverter.ObjectToInt(dt.Rows[i]["aid"]);
                    goodsinfoarray[i].Goodspic = dt.Rows[i]["goodspic"].ToString();
                    goodsinfoarray[i].Displayorder = TypeConverter.ObjectToInt(dt.Rows[i]["displayorder"]);
                    goodsinfoarray[i].Costprice = Convert.ToDecimal(dt.Rows[i]["costprice"].ToString());
                    goodsinfoarray[i].Invoice = TypeConverter.ObjectToInt(dt.Rows[i]["invoice"]);
                    goodsinfoarray[i].Repair = TypeConverter.ObjectToInt(dt.Rows[i]["repair"]);
                    goodsinfoarray[i].Message = dt.Rows[i]["message"].ToString();
                    goodsinfoarray[i].Otherlink = dt.Rows[i]["otherlink"].ToString();
                    goodsinfoarray[i].Readperm = TypeConverter.ObjectToInt(dt.Rows[i]["readperm"]);
                    goodsinfoarray[i].Tradetype = TypeConverter.ObjectToInt(dt.Rows[i]["tradetype"]);
                    goodsinfoarray[i].Viewcount = TypeConverter.ObjectToInt(dt.Rows[i]["viewcount"]);
                    goodsinfoarray[i].Smileyoff = TypeConverter.ObjectToInt(dt.Rows[i]["smileyoff"]);
                    goodsinfoarray[i].Bbcodeoff = TypeConverter.ObjectToInt(dt.Rows[i]["bbcodeoff"]);
                    goodsinfoarray[i].Parseurloff = TypeConverter.ObjectToInt(dt.Rows[i]["parseurloff"]);
                    goodsinfoarray[i].Highlight = dt.Rows[i]["highlight"].ToString().Trim();
                    goodsinfoarray[i].Title = dt.Rows[i]["title"].ToString();
                    goodsinfoarray[i].Htmltitle = SetMagicTitle(goodsinfoarray[i]);

                }
                dt.Dispose();
                return goodsinfoarray;
            }
コード例 #15
0
ファイル: Goods.cs プロジェクト: Vinna/DeepInSummer
            /// <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;
            }
コード例 #16
0
ファイル: Goods.cs プロジェクト: Vinna/DeepInSummer
            /// <summary>
            /// 设置魔法主题
            /// </summary>
            /// <param name="goodsinfo">要设置的商品信息</param>
            /// <returns></returns>
            public static string SetMagicTitle(Goodsinfo goodsInfo)
            {
                if (Topics.GetMagicValue(goodsInfo.Magic, MagicType.HtmlTitle) == 1)
                    return Goods.GetHtmlTitle(goodsInfo.Goodsid);

                if (goodsInfo.Highlight != "")
                    return "<span style=\"" + goodsInfo.Highlight + "\">" + goodsInfo.Title + "</span>";
                else
                    return goodsInfo.Title;
            }
コード例 #17
0
ファイル: Goods.cs プロジェクト: Vinna/DeepInSummer
        /// <summary>
        /// 创建商品数据信息
        /// </summary>
        /// <param name="goodsinfo">商品信息</param>
        /// <returns>创建商品的id</returns>
        public static int CreateGoods(Goodsinfo goodsInfo)
        {
            int goodsid = DbProvider.GetInstance().CreateGoods(goodsInfo);

            //当成功创建商品信息且可在前台正常显示时
            if (goodsid > 0 && goodsInfo.Displayorder>=0) 
                DbProvider.GetInstance().UpdateCategoryGoodsCounts(goodsInfo.Categoryid, goodsInfo.Parentcategorylist, 1);

            return goodsid;
        }
コード例 #18
0
		/// <summary>
		/// Gets the index in the collection of the specified <see cref="GoodsinfoCollection">GoodsinfoCollection</see>, if it exists in the collection.
		/// </summary>
		/// <param name="value">The <see cref="GoodsinfoCollection">GoodsinfoCollection</see> to locate in the collection.</param>
		/// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
        public int IndexOf(Goodsinfo value) 
		{
			return this.List.IndexOf(value);
		}
コード例 #19
0
		/// <summary>
		/// Gets a value indicating whether the collection contains the specified <see cref="GoodsinfoCollection">GoodsinfoCollection</see>.
		/// </summary>
		/// <param name="value">The <see cref="GoodsinfoCollection">GoodsinfoCollection</see> to search for in the collection.</param>
		/// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
        public bool Contains(Goodsinfo value) 
		{
			return this.List.Contains(value);
		}
コード例 #20
0
        public void Insert(int index, Goodsinfo value)	
		{
			List.Insert(index, value);
		}
コード例 #21
0
ファイル: onlinetrade.cs プロジェクト: Vinna/DeepInSummer
        private bool IsConditionsValid()
        {
            if (goodstradelog.Offline == 1)
            {
                AddErrLine("当前交易为离线交易!");
                return false;
            }

            //当前用户为买家时
            if (goodstradelog.Buyerid == userid)
                isbuyer = true;

            //当前用户为卖家时
            if (goodstradelog.Sellerid == userid)
                isseller = true;

            //当前用户既不是买家也不是卖家
            if (!isbuyer && !isseller)
            {
                AddErrLine("当前用户身份既不是买家也不是卖家!");
                return false;
            }
            if (goodstradelog.Buyerid <= 0)
            {
                AddErrLine("商品买家信息错误!");
                return false;
            }
            if (goodstradelog.Sellerid <= 0)
            {
                AddErrLine("商品卖家信息错误!");
                return false;
            }

            int goodsid = goodstradelog.Goodsid;
            // 如果商品ID无效
            if (goodsid <= 0)
            {
                AddErrLine("无效的商品ID");
                return false;
            }

            goodsinfo = Goods.GetGoodsInfo(goodsid);
            if (goodsinfo.Displayorder == -1)
            {
                AddErrLine("此商品已被删除!");
                return false;
            }
            if (goodsinfo.Displayorder == -2)
            {
                AddErrLine("此商品未经审核!");
                return false;
            }
            if (goodsinfo.Expiration <= DateTime.Now)
            {
                AddErrLine("非常抱歉, 该商品不存在或已经到期!");
                return false;
            }

            return true;
        }
コード例 #22
0
		/// <summary>
		/// Initializes a new instance of the <see cref="GoodsinfoCollection">GoodsinfoCollection</see> class containing the specified array of <see cref="GoodsinfoCollection">GoodsinfoCollection</see> Components.
		/// </summary>
		/// <param name="value">An array of <see cref="GoodsinfoCollection">GoodsinfoCollection</see> Components with which to initialize the collection. </param>
        public GoodsinfoCollection(Goodsinfo[] value)
		{
			this.AddRange(value);
		}
コード例 #23
0
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref="GoodsinfoCollection">GoodsinfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref="GoodsinfoCollection">GoodsinfoCollection</see> to search for in the collection.</param>
 /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
 public bool Contains(Goodsinfo value)
 {
     return(this.List.Contains(value));
 }
コード例 #24
0
 public void Remove(Goodsinfo value)
 {
     List.Remove(value);
 }
コード例 #25
0
ファイル: Goods.cs プロジェクト: Vinna/DeepInSummer
 /// <summary>
 /// 更新指定商品数据信息
 /// </summary>
 /// <param name="goodsinfo">商品信息</param>
 /// <returns></returns>
 public static void UpdateGoods(Goodsinfo goodsInfo)
 {
     DbProvider.GetInstance().UpdateGoods(goodsInfo); 
 }
コード例 #26
0
		/// <summary>
		/// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index.
		/// </summary>
		/// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param>
		/// <param name="index">The index of the array at which to begin inserting.</param>
        public void CopyTo(Goodsinfo[] array, int index) 
		{
			this.List.CopyTo(array, index);
		}
コード例 #27
0
 public int Add(Goodsinfo value)
 {
     return(this.List.Add(value));
 }