/// <summary> /// Copies the elements of the specified <see cref="GoodstradeloginfoCollection">GoodstradeloginfoCollection</see> array to the end of the collection. /// </summary> /// <param name="value">An array of type <see cref="GoodstradeloginfoCollection">GoodstradeloginfoCollection</see> containing the Components to add to the collection.</param> public void AddRange(Goodstradeloginfo[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
/// <summary> /// 更新交易信息 /// </summary> /// <param name="__goodstradelog">要更新的交易信息</param> /// <param name="oldstatus">本次更新之前的状态</param> /// <returns>是否更新成功</returns> public static bool UpdateTradeLog(Goodstradeloginfo goodsTradeLog, int oldstatus) { if (goodsTradeLog.Buyermsg.Length > 100) goodsTradeLog.Buyermsg = goodsTradeLog.Buyermsg.Substring(0, 100); if (goodsTradeLog.Buyercontact.Length > 100) goodsTradeLog.Buyercontact = goodsTradeLog.Buyercontact.Substring(0, 100); goodsTradeLog.Tradesum = goodsTradeLog.Number * goodsTradeLog.Price + (goodsTradeLog.Transportpay == 2 ? goodsTradeLog.Transportfee : 0); //当交易状态发生变化时 if (goodsTradeLog.Status != oldstatus) { if (goodsTradeLog.Number > 0) { //获取当前交易的商品信息 Goodsinfo goodsInfo = Goods.GetGoodsInfo(goodsTradeLog.Goodsid); //当交易从中途关闭(未完成)状态变为生效(Status: 1为生效, 4为买家已付款等待卖家发货)时更新商品数量) if (oldstatus == 8 && (goodsTradeLog.Status == 1 || goodsTradeLog.Status == 4)) { //当商品库存变为0(负)库存时 if (goodsInfo.Amount > 0 && (goodsInfo.Amount - goodsTradeLog.Number) <= 0) DbProvider.GetInstance().UpdateCategoryGoodsCounts(goodsInfo.Categoryid, goodsInfo.Parentcategorylist, -1); goodsInfo.Totalitems = goodsInfo.Totalitems + goodsTradeLog.Number; //累加总交易量 goodsInfo.Amount = goodsInfo.Amount - goodsTradeLog.Number; //减少当前商品数量 goodsInfo.Tradesum = goodsInfo.Tradesum + goodsTradeLog.Tradesum; //累加总交易额 } //当退款成功后(Status = 17, 表示此次交易无效,同时更新商品信息并还原商品数目) //或交易中途关闭,未完成(Status = 8, 更新商品数量) if (goodsTradeLog.Status == 17 || goodsTradeLog.Status == 8) { //当商品库存从0(负)库存变为有效库存时 if (goodsInfo.Amount <= 0 && (goodsInfo.Amount + goodsTradeLog.Number) > 0) DbProvider.GetInstance().UpdateCategoryGoodsCounts(goodsInfo.Categoryid, goodsInfo.Parentcategorylist, 1); goodsInfo.Totalitems = goodsInfo.Totalitems - goodsTradeLog.Number; //减少总交易量 goodsInfo.Amount = goodsInfo.Amount + goodsTradeLog.Number; //还原当前商品数量 goodsInfo.Tradesum = goodsInfo.Tradesum - goodsTradeLog.Tradesum;//减少总交易额 } goodsInfo.Lastbuyer = goodsTradeLog.Buyer; goodsInfo.Lasttrade = DateTime.Now; Goods.UpdateGoods(goodsInfo); } } return DbProvider.GetInstance().UpdateGoodsTradeLog(goodsTradeLog); }
/// <summary> /// 创建商品交易日志 /// </summary> /// <param name="__goodstradelog">要创建的商品交易日志</param> /// <returns>创建的商品交易日志id</returns> public static int CreateTradeLog(Goodstradeloginfo goodsTradeLog) { //当为支付宝付款方式时,将订单号绑定到tradeno字段 if (goodsTradeLog.Offline == 0) goodsTradeLog.Tradeno = goodsTradeLog.Orderid; if (goodsTradeLog.Buyermsg.Length > 100) goodsTradeLog.Buyermsg = goodsTradeLog.Buyermsg.Substring(0, 100); if (goodsTradeLog.Buyercontact.Length > 100) goodsTradeLog.Buyercontact = goodsTradeLog.Buyercontact.Substring(0, 100); if (goodsTradeLog.Number > 0) { //更新商品数量和最近交易信息 Goodsinfo goodsInfo = Goods.GetGoodsInfo(goodsTradeLog.Goodsid); if (goodsInfo != null && goodsInfo.Goodsid > 0) { //当商品库存变为0(负)库存时 if (goodsInfo.Amount > 0 && (goodsInfo.Amount - goodsTradeLog.Number) <= 0) DbProvider.GetInstance().UpdateCategoryGoodsCounts(goodsInfo.Categoryid, goodsInfo.Parentcategorylist, -1); goodsInfo.Totalitems = goodsInfo.Totalitems + goodsTradeLog.Number; //累加总交易量 goodsInfo.Amount = goodsInfo.Amount - goodsTradeLog.Number; //减少当前商品数量 goodsInfo.Tradesum = goodsInfo.Tradesum + goodsTradeLog.Tradesum; //累加总交易额 goodsInfo.Lastbuyer = goodsTradeLog.Buyer; goodsInfo.Lasttrade = DateTime.Now; Goods.UpdateGoods(goodsInfo); } } goodsTradeLog.Id = DbProvider.GetInstance().CreateGoodsTradeLog(goodsTradeLog); SendNotice(goodsTradeLog); return goodsTradeLog.Id; }
public int Add(Goodstradeloginfo value) { return this.List.Add(value); }
/// <summary> /// Initializes a new instance of the <see cref="GoodstradeloginfoCollection">GoodstradeloginfoCollection</see> class containing the specified array of <see cref="GoodstradeloginfoCollection">GoodstradeloginfoCollection</see> Components. /// </summary> /// <param name="value">An array of <see cref="GoodstradeloginfoCollection">GoodstradeloginfoCollection</see> Components with which to initialize the collection. </param> public GoodstradeloginfoCollection(Goodstradeloginfo[] value) { this.AddRange(value); }
/// <summary> /// 更新商品交易信息 /// </summary> /// <param name="goodstradelog">要更新的交易信息</param> /// <returns></returns> public bool UpdateGoodsTradeLog(Goodstradeloginfo goodsTradeLog) { DbParameter[] parms = { DbHelper.MakeInParam("@goodsid", (DbType)SqlDbType.Int, 4,goodsTradeLog.Goodsid), DbHelper.MakeInParam("@orderid", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Orderid), DbHelper.MakeInParam("@tradeno", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Tradeno), DbHelper.MakeInParam("@subject", (DbType)SqlDbType.NChar, 60,goodsTradeLog.Subject), DbHelper.MakeInParam("@price", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Price), DbHelper.MakeInParam("@quality", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Quality), DbHelper.MakeInParam("@categoryid", (DbType)SqlDbType.Int, 4,goodsTradeLog.Categoryid), DbHelper.MakeInParam("@number", (DbType)SqlDbType.SmallInt, 2,goodsTradeLog.Number), DbHelper.MakeInParam("@tax", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Tax), DbHelper.MakeInParam("@locus", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Locus), DbHelper.MakeInParam("@sellerid", (DbType)SqlDbType.Int, 4,goodsTradeLog.Sellerid), DbHelper.MakeInParam("@seller", (DbType)SqlDbType.NChar, 20,goodsTradeLog.Seller), DbHelper.MakeInParam("@selleraccount", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Selleraccount), DbHelper.MakeInParam("@buyerid", (DbType)SqlDbType.Int, 4,goodsTradeLog.Buyerid), DbHelper.MakeInParam("@buyer", (DbType)SqlDbType.NChar, 20,goodsTradeLog.Buyer), DbHelper.MakeInParam("@buyercontact", (DbType)SqlDbType.NChar, 100,goodsTradeLog.Buyercontact), DbHelper.MakeInParam("@buyercredit", (DbType)SqlDbType.SmallInt, 2,goodsTradeLog.Buyercredit), DbHelper.MakeInParam("@buyermsg", (DbType)SqlDbType.NChar, 100,goodsTradeLog.Buyermsg), DbHelper.MakeInParam("@status", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Status), DbHelper.MakeInParam("@lastupdate", (DbType)SqlDbType.DateTime, 8,goodsTradeLog.Lastupdate), DbHelper.MakeInParam("@offline", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Offline), DbHelper.MakeInParam("@buyername", (DbType)SqlDbType.NChar, 20,goodsTradeLog.Buyername), DbHelper.MakeInParam("@buyerzip", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Buyerzip), DbHelper.MakeInParam("@buyerphone", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Buyerphone), DbHelper.MakeInParam("@buyermobile", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Buyermobile), DbHelper.MakeInParam("@transport", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Transport), DbHelper.MakeInParam("@transportpay", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Transportpay), DbHelper.MakeInParam("@transportfee", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Transportfee), DbHelper.MakeInParam("@tradesum", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Tradesum), DbHelper.MakeInParam("@baseprice", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Baseprice), DbHelper.MakeInParam("@discount", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Discount), DbHelper.MakeInParam("@ratestatus", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Ratestatus), DbHelper.MakeInParam("@message", (DbType)SqlDbType.NText, 0,goodsTradeLog.Message), DbHelper.MakeInParam("@id", (DbType)SqlDbType.Int, 4,goodsTradeLog.Id) }; string commandText = String.Format("Update [{0}goodstradelogs] Set [goodsid] = @goodsid, [orderid] = @orderid, [tradeno] = @tradeno, [subject] = @subject, [price] = @price, [quality] = @quality, [categoryid] = @categoryid, [number] = @number, [tax] = @tax, [locus] = @locus, [sellerid] = @sellerid, [seller] = @seller, [selleraccount] = @selleraccount, [buyerid] = @buyerid, [buyer] = @buyer, [buyercontact] = @buyercontact, [buyercredit] = @buyercredit, [buyermsg] = @buyermsg, [status] = @status, [lastupdate] = @lastupdate, [offline] = @offline, [buyername] = @buyername, [buyerzip] = @buyerzip, [buyerphone] = @buyerphone, [buyermobile] = @buyermobile, [transport] = @transport, [transportpay] = @transportpay, [transportfee] = @transportfee, [tradesum] = @tradesum, [baseprice] = @baseprice, [discount] = @discount, [ratestatus] = @ratestatus, [message] = @message WHERE [id] = @id", BaseConfigs.GetTablePrefix); DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); return true; }
/// <summary> /// 获得商品交易信息(DTO) /// </summary> /// <param name="dt">要转换的数据表</param> /// <returns>返回商品交易信息</returns> public static Goodstradeloginfo[] GetGoodsTradeLogInfoArray(DataTable dt) { if (dt == null || dt.Rows.Count == 0) return null; Goodstradeloginfo[] goodsTradeLogInfoArray = new Goodstradeloginfo[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { goodsTradeLogInfoArray[i] = new Goodstradeloginfo(); goodsTradeLogInfoArray[i].Id = TypeConverter.ObjectToInt(dt.Rows[i]["id"]); goodsTradeLogInfoArray[i].Goodsid = TypeConverter.ObjectToInt(dt.Rows[i]["goodsid"]); goodsTradeLogInfoArray[i].Orderid = dt.Rows[i]["orderid"].ToString(); goodsTradeLogInfoArray[i].Tradeno = dt.Rows[i]["tradeno"].ToString(); goodsTradeLogInfoArray[i].Subject = dt.Rows[i]["subject"].ToString(); goodsTradeLogInfoArray[i].Price = Convert.ToDecimal(dt.Rows[i]["price"].ToString()); goodsTradeLogInfoArray[i].Quality = TypeConverter.ObjectToInt(dt.Rows[i]["quality"]); goodsTradeLogInfoArray[i].Categoryid = TypeConverter.ObjectToInt(dt.Rows[i]["categoryid"]); goodsTradeLogInfoArray[i].Number = TypeConverter.ObjectToInt(dt.Rows[i]["number"]); goodsTradeLogInfoArray[i].Tax = Convert.ToDecimal(dt.Rows[i]["tax"].ToString()); goodsTradeLogInfoArray[i].Locus = dt.Rows[i]["locus"].ToString(); goodsTradeLogInfoArray[i].Sellerid = TypeConverter.ObjectToInt(dt.Rows[i]["sellerid"]); goodsTradeLogInfoArray[i].Seller = dt.Rows[i]["seller"].ToString(); goodsTradeLogInfoArray[i].Selleraccount = dt.Rows[i]["selleraccount"].ToString(); goodsTradeLogInfoArray[i].Buyerid = TypeConverter.ObjectToInt(dt.Rows[i]["buyerid"]); goodsTradeLogInfoArray[i].Buyer = dt.Rows[i]["buyer"].ToString(); goodsTradeLogInfoArray[i].Buyercontact = dt.Rows[i]["buyercontact"].ToString(); goodsTradeLogInfoArray[i].Buyercredit = TypeConverter.ObjectToInt(dt.Rows[i]["buyercredit"]); goodsTradeLogInfoArray[i].Buyermsg = dt.Rows[i]["buyermsg"].ToString(); goodsTradeLogInfoArray[i].Status = TypeConverter.ObjectToInt(dt.Rows[i]["status"]); goodsTradeLogInfoArray[i].Lastupdate = Convert.ToDateTime(dt.Rows[i]["lastupdate"].ToString()); goodsTradeLogInfoArray[i].Offline = TypeConverter.ObjectToInt(dt.Rows[i]["offline"]); goodsTradeLogInfoArray[i].Buyername = dt.Rows[i]["buyername"].ToString(); goodsTradeLogInfoArray[i].Buyerzip = dt.Rows[i]["buyerzip"].ToString(); goodsTradeLogInfoArray[i].Buyerphone = dt.Rows[i]["buyerphone"].ToString(); goodsTradeLogInfoArray[i].Buyermobile = dt.Rows[i]["buyermobile"].ToString(); goodsTradeLogInfoArray[i].Transport = TypeConverter.ObjectToInt(dt.Rows[i]["transport"]); goodsTradeLogInfoArray[i].Transportpay = TypeConverter.ObjectToInt(dt.Rows[i]["transportpay"]); goodsTradeLogInfoArray[i].Transportfee = Convert.ToDecimal(dt.Rows[i]["transportfee"].ToString()); goodsTradeLogInfoArray[i].Tradesum = Convert.ToDecimal(dt.Rows[i]["tradesum"].ToString()); goodsTradeLogInfoArray[i].Baseprice = Convert.ToDecimal(dt.Rows[i]["baseprice"].ToString()); goodsTradeLogInfoArray[i].Discount = TypeConverter.ObjectToInt(dt.Rows[i]["discount"]); goodsTradeLogInfoArray[i].Ratestatus = TypeConverter.ObjectToInt(dt.Rows[i]["ratestatus"]); goodsTradeLogInfoArray[i].Message = dt.Rows[i]["message"].ToString(); } dt.Dispose(); return goodsTradeLogInfoArray; }
/// <summary> /// 更新交易信息 /// </summary> /// <param name="__goodstradelog">要更新的交易信息</param> /// <param name="oldstatus">更新之前的状态</param> /// <param name="issendpm">更新交易信息成功后, 是否发送短消息</param> /// <returns>是否更新成功</returns> public static bool UpdateTradeLog(Goodstradeloginfo goodsTradeLog, int oldStatus, bool isSendPm) { bool result = UpdateTradeLog(goodsTradeLog, oldStatus); if (result && isSendPm) SendNotice(goodsTradeLog); return result; }
public bool Contains(Goodstradeloginfo value) { return(base.List.Contains(value)); }
public int Add(Goodstradeloginfo value) { return(base.List.Add(value)); }
public void Remove(Goodstradeloginfo value) { base.List.Remove(value); }
public void Insert(int index, Goodstradeloginfo value) { base.List.Insert(index, value); }
protected override void ShowPage() { if (config.Enablemall == 0) //未启用交易服务 { AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!"); return; } if (userid == -1) { AddErrLine("你尚未登录"); return; } headerad = ""; footerad = ""; // 如果商品交易日志不正确 if (goodstradelogid <= 0) { AddErrLine("无效的交易日志信息."); return; } goodstradelog = TradeLogs.GetGoodsTradeLogInfo(goodstradelogid); int oldstatus = goodstradelog.Status; if (config.Enablemall == 1) //开启普通模式 forumid = GoodsCategories.GetCategoriesFid(goodstradelog.Categoryid); else forumid = 0; ///得到广告列表 ///头部 headerad = Advertisements.GetOneHeaderAd("", forumid); footerad = Advertisements.GetOneFooterAd("", forumid); doublead = Advertisements.GetDoubleAd("", forumid); floatad = Advertisements.GetFloatAd("", forumid); if (goodstradelog.Sellerid != userid && goodstradelog.Buyerid != userid) { AddErrLine("您的身份不是买卖双方, 因为不能评价"); return; } if (goodstradelog.Status != 7 && goodstradelog.Status != 17) { AddErrLine("交易尚未结束, 因为不能评价"); return; } if (!GoodsRates.CanRate(goodstradelog.Id, userid)) //如果当前用户已评价过则不允许再评价 { AddErrLine("不能重复评价"); return; } //如果是提交... if (ispost) { Goodsrateinfo goodsrateinfo = new Goodsrateinfo(); goodsrateinfo.Ip = DNTRequest.GetIP(); goodsrateinfo.Postdatetime = DateTime.Now; goodsrateinfo.Price = goodstradelog.Number * goodstradelog.Price + goodstradelog.Transportfee; goodsrateinfo.Ratetype = DNTRequest.GetInt("ratetype", 0); goodsrateinfo.Uid = userid; goodsrateinfo.Username = username; goodsrateinfo.Message = DNTRequest.GetString("message"); goodsrateinfo.Goodstradelogid = goodstradelog.Id; goodsrateinfo.Goodstitle = goodstradelog.Subject; goodsrateinfo.Goodsid = goodstradelog.Goodsid; goodsrateinfo.Explain = ""; if (goodstradelog.Buyerid == userid) //买家 { goodsrateinfo.Uidtype = 2; goodsrateinfo.Ratetouid = goodstradelog.Sellerid; goodsrateinfo.Ratetousername = goodstradelog.Seller; goodstradelog.Ratestatus = 2; } else //卖家 { goodsrateinfo.Uidtype = 1; goodsrateinfo.Ratetouid = goodstradelog.Buyerid; goodsrateinfo.Ratetousername = goodstradelog.Buyer; goodstradelog.Ratestatus = 1; } if (GoodsRates.CreateGoodsRate(goodsrateinfo) > 0) //如果评价成功 { if(GoodsRates.RateClosed(goodsrateinfo.Goodstradelogid,goodstradelog.Sellerid,goodstradelog.Buyerid)) { goodstradelog.Ratestatus = 3; TradeLogs.UpdateTradeLog(goodstradelog, oldstatus); //更新交易的评价状态 } GoodsUserCredits.SetUserCredit(goodsrateinfo, goodsrateinfo.Uidtype == 1 ? goodstradelog.Buyerid : goodstradelog.Sellerid); SetUrl(base.ShowGoodsAspxRewrite(goodsrateinfo.Goodsid)); SetMetaRefresh(); AddMsgLine("您的评价已经成功<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsrateinfo.Goodsid) + "\">点击这里返回商品页面</a>)<br />"); } } }
protected override void ShowPage() { if (config.Enablemall == 0) //未启用交易服务 { AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!"); return; } headerad = ""; footerad = ""; floatad = ""; // 如果商品交易日志不正确 if (goodstradelogid <= 0) { AddErrLine("无效的交易日志信息."); return; } goodstradelog = TradeLogs.GetGoodsTradeLogInfo(goodstradelogid); int oldstatus = goodstradelog.Status; if (config.Enablemall == 1) //开启普通模式 { forumid = GoodsCategories.GetCategoriesFid(goodstradelog.Categoryid); forum = Forums.GetForumInfo(forumid); forumname = forum.Name; 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); pagetitle = goodstradelog.Subject; 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 (!IsConditionsValid()) return; if (goodstradelog.Status == 7 || goodstradelog.Status == 17) israted = GoodsRates.CanRate(goodstradelog.Id, userid) ? false : true; //如果当前用户已评价过则不允许再评价 if (DNTRequest.GetString("pay") == "yes") { ispay = true; string alipayurl = GetAliPayUrl(); SetUrl(alipayurl); SetMetaRefresh(); AddMsgLine("正在提交编号为 " + goodstradelog.Tradeno + " 的订单<br />(<a href=\"" + alipayurl + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />"); return; } //如果是提交则更新商品交易日志 if (ispost) { if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } //当为买家时 if (isbuyer) { goodstradelog.Quality = goodsinfo.Quality; goodstradelog.Categoryid = goodsinfo.Categoryid; goodstradelog.Tax = 0; goodstradelog.Locus = goodsinfo.Locus; goodstradelog.Seller = goodsinfo.Seller; goodstradelog.Sellerid = goodsinfo.Selleruid; goodstradelog.Selleraccount = goodsinfo.Account; goodstradelog.Buyerid = userid; goodstradelog.Buyer = username; goodstradelog.Buyercontact = DNTRequest.GetString("buyercontact"); goodstradelog.Buyercredit = 0; goodstradelog.Buyermsg = DNTRequest.GetString("buyermsg"); goodstradelog.Status = 0; 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 = goodsinfo.Transport; goodstradelog.Baseprice = goodsinfo.Costprice; goodstradelog.Discount = goodsinfo.Discount; goodstradelog.Ratestatus = 0; goodstradelog.Message = ""; } else //当为卖家时 goodstradelog.Transportfee = DNTRequest.GetInt("fee", 0); if (TradeLogs.UpdateTradeLog(goodstradelog, oldstatus)) { SetUrl("onlinetrade.aspx?goodstradelogid=" + goodstradelogid); SetMetaRefresh(); AddMsgLine("交易单已更新, 现在转入交易单页面<br />(<a href=\"" + "onlinetrade.aspx?goodstradelogid=" + goodstradelogid + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />"); } } }
protected override void ShowPage() { if (config.Enablemall == 0) //未启用交易服务 { AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!"); return; } headerad = ""; footerad = ""; // 如果商品交易日志不正确 if (goodstradelogid <= 0) { AddErrLine("无效的交易日志信息."); return; } goodstradelog = TradeLogs.GetGoodsTradeLogInfo(goodstradelogid); int oldstatus = goodstradelog.Status; if (config.Enablemall == 1) //开启普通模式 { forumid = GoodsCategories.GetCategoriesFid(goodstradelog.Categoryid); forum = Forums.GetForumInfo(forumid); forumname = forum.Name; 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); pagetitle = goodstradelog.Subject; 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 (!IsConditionsValid()) return; goodsleavewordlist = GoodsLeaveWords.GetLeaveWordList(goodstradelog.Id); if (goodstradelog.Status == 7 || goodstradelog.Status == 17) israted = GoodsRates.CanRate(goodstradelog.Id, userid) ? false : true; //如果当前用户已评价过则不允许再评价 //如果是提交则更新商品交易日志 if (ispost && goodstradelog.Status >= 0) { if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } //当要验证密码时 if (DNTRequest.GetInt("status", -1) > 0 && IsVerifyPassWord(goodstradelog.Status)) { if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("password"))) { AddErrLine("密码不能为空, 请返回填写."); return; } int uid = -1; if (config.Passwordmode == 1) uid = Users.CheckDvBbsPassword(base.username, DNTRequest.GetString("password")); else uid = Users.CheckPassword(username, DNTRequest.GetString("password"), true); if (uid < 0) { AddErrLine("您输入的密码不正确, 不能修改订单状态, 请返回修改."); return; } //当验证密码正确后,则发送相应留言 Goodsleavewordinfo goodsleavewordinfo = new Goodsleavewordinfo(); goodsleavewordinfo.Ip = DNTRequest.GetIP(); goodsleavewordinfo.Goodsid = goodstradelog.Goodsid; goodsleavewordinfo.Tradelogid = goodstradelog.Id; goodsleavewordinfo.Uid = userid; goodsleavewordinfo.Username = username; goodsleavewordinfo.Message = DNTRequest.GetString("message"); goodsleavewordinfo.Isbuyer = buyerleaveword; GoodsLeaveWords.CreateLeaveWord(goodsleavewordinfo, goodsinfo.Selleruid); } goodstradelog.Status = DNTRequest.GetInt("status", -1); if (goodstradelog.Status == 0) { //当为买家时 if (isbuyer) { goodstradelog.Quality = goodsinfo.Quality; goodstradelog.Categoryid = goodsinfo.Categoryid; goodstradelog.Tax = 0; goodstradelog.Locus = goodsinfo.Locus; goodstradelog.Seller = goodsinfo.Seller; goodstradelog.Sellerid = goodsinfo.Selleruid; goodstradelog.Selleraccount = goodsinfo.Account; goodstradelog.Buyerid = userid; goodstradelog.Buyer = username; goodstradelog.Buyercontact = DNTRequest.GetString("buyercontact"); goodstradelog.Buyercredit = 0; goodstradelog.Buyermsg = DNTRequest.GetString("buyermsg"); 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 = goodsinfo.Transport; goodstradelog.Baseprice = goodsinfo.Costprice; goodstradelog.Discount = goodsinfo.Discount; goodstradelog.Ratestatus = 0; goodstradelog.Message = ""; } if (isseller) //当为卖家时 goodstradelog.Transportfee = DNTRequest.GetInt("fee", 0); } if (TradeLogs.UpdateTradeLog(goodstradelog, oldstatus, true)) { SetUrl("offlinetrade.aspx?goodstradelogid=" + goodstradelogid); SetMetaRefresh(); AddMsgLine("交易单已更新, 现在转入交易单页面<br />(<a href=\"" + "offlinetrade.aspx?goodstradelogid=" + goodstradelogid + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />"); } } }
/// <summary> /// Gets a value indicating whether the collection contains the specified <see cref="GoodstradeloginfoCollection">GoodstradeloginfoCollection</see>. /// </summary> /// <param name="value">The <see cref="GoodstradeloginfoCollection">GoodstradeloginfoCollection</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(Goodstradeloginfo value) { return this.List.Contains(value); }
/// <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(Goodstradeloginfo[] array, int index) { this.List.CopyTo(array, index); }
public int IndexOf(Goodstradeloginfo value) { return(base.List.IndexOf(value)); }
/// <summary> /// 根据交易日志的状态发送相应通知 /// </summary> /// <param name="__goodstradelog">交易日志信息</param> /// <returns>是否发送成功</returns> public static bool SendNotice(Goodstradeloginfo goodsTradeLog) { string noticeContent = "这是由论坛系统自动发送的通知短消息.<BR />"; bool isSendNotice = false; int noticeUid = 0; int posterId = 0; string poster = ""; string pageName = goodsTradeLog.Offline == 1 ? "offlinetrade.aspx" : "onlinetrade.aspx"; switch ((TradeStatusEnum)goodsTradeLog.Status) { case TradeStatusEnum.UnStart: { noticeContent = string.Format("买家 {0} 购买您的商品 {1}. 但交易尚未生效, 等待您的确认, 请<a href =\"" + pageName + "?goodstradelogid={2}\">点击这里</a>查看详情.", goodsTradeLog.Buyer, goodsTradeLog.Subject, goodsTradeLog.Id); isSendNotice = true; noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; break; } case TradeStatusEnum.WAIT_SELLER_SEND_GOODS: { noticeContent = string.Format("买家 {0} 购买您的商品 {1}. 买家已付款, 等待您发货, 请<a href =\"" + pageName + "?goodstradelogid={2}\">点击这里</a>查看详情.", goodsTradeLog.Buyer, goodsTradeLog.Subject, goodsTradeLog.Id); isSendNotice = true; noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; break; } case TradeStatusEnum.WAIT_BUYER_CONFIRM_GOODS: { noticeContent = string.Format("您购买的商品 {0} . 卖家 {1} 已发货, 等待您的确认, 请<a href =\"" + pageName + "?goodstradelogid={2}\">点击这里</a>查看详情.", goodsTradeLog.Subject, goodsTradeLog.Seller, goodsTradeLog.Id); noticeUid = goodsTradeLog.Buyerid; posterId = goodsTradeLog.Sellerid; poster = goodsTradeLog.Seller; isSendNotice = true; break; } case TradeStatusEnum.WAIT_SELLER_AGREE: { noticeContent = string.Format("买家 {0} 等待你同意退款, 请<a href =\"" + pageName + "?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Buyer, goodsTradeLog.Id); isSendNotice = true; noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; break; } case TradeStatusEnum.SELLER_REFUSE_BUYER: { noticeContent = string.Format("卖家 {0} 拒绝您的条件, 等待您修改条件, 请<a href =\"" + pageName + "?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Seller, goodsTradeLog.Id); isSendNotice = true; noticeUid = goodsTradeLog.Buyerid; posterId = goodsTradeLog.Sellerid; poster = goodsTradeLog.Seller; break; } case TradeStatusEnum.WAIT_BUYER_RETURN_GOODS: { noticeContent = string.Format("卖家 {0} 同意退款, 等待您退货, 请<a href =\"" + pageName + "?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Seller, goodsTradeLog.Id); noticeUid = goodsTradeLog.Buyerid; posterId = goodsTradeLog.Sellerid; poster = goodsTradeLog.Seller; isSendNotice = true; break; } case TradeStatusEnum.WAIT_SELLER_CONFIRM_GOODS: { noticeContent = string.Format("买家 {0} 已退货, 等待您收货, 请<a href =\"" + pageName + "?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Buyer, goodsTradeLog.Id); noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; isSendNotice = true; break; } case TradeStatusEnum.TRADE_FINISHED: { noticeContent = string.Format("商品 {0} 已交易成功, 请<a href =\"goodsrate.aspx?goodstradelogid={1}\">点击这里</a>给对方评分.", goodsTradeLog.Subject, goodsTradeLog.Id); noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; isSendNotice = true; break; } case TradeStatusEnum.TRADE_CLOSED: { noticeContent = string.Format("商品 {0} 交易失败, 卖家取消交易, 请<a href =\"goodsrate.aspx?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Subject, goodsTradeLog.Id); noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; isSendNotice = true; break; } case TradeStatusEnum.REFUND_SUCCESS: { noticeContent = string.Format("商品 {0} 已退款成功, 请<a href =\"goodsrate.aspx?goodstradelogid={1}\">点击这里</a>给对方评分.", goodsTradeLog.Subject, goodsTradeLog.Id); noticeUid = goodsTradeLog.Buyerid; posterId = goodsTradeLog.Sellerid; poster = goodsTradeLog.Seller; isSendNotice = true; break; } } //发送通知 if (isSendNotice) { NoticeInfo noticeInfo = new NoticeInfo(); //商品交易通知 noticeInfo.Note = Utils.HtmlEncode(noticeContent); noticeInfo.Uid = noticeUid; noticeInfo.Type = NoticeType.GoodsTradeNotice; noticeInfo.New = 1; noticeInfo.Posterid = posterId; noticeInfo.Poster = poster; noticeInfo.Postdatetime = Utils.GetDateTime(); Notices.CreateNoticeInfo(noticeInfo); } return true; }
/// <summary> /// Gets the index in the collection of the specified <see cref="GoodstradeloginfoCollection">GoodstradeloginfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="GoodstradeloginfoCollection">GoodstradeloginfoCollection</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(Goodstradeloginfo value) { return this.List.IndexOf(value); }
/// <summary> /// 获得商品交易信息(DTO) /// </summary> /// <param name="__idatareader">要转换的数据</param> /// <returns>返回商品交易信息</returns> public static GoodstradeloginfoCollection GetGoodsTradeLogInfoList(IDataReader reader) { GoodstradeloginfoCollection goodsTradeLogInfoColl = new GoodstradeloginfoCollection(); while (reader.Read()) { Goodstradeloginfo goodsTradeLogInfo = new Goodstradeloginfo(); goodsTradeLogInfo.Id = TypeConverter.ObjectToInt(reader["id"]); goodsTradeLogInfo.Goodsid = TypeConverter.ObjectToInt(reader["goodsid"]); goodsTradeLogInfo.Orderid = reader["orderid"].ToString().Trim(); goodsTradeLogInfo.Tradeno = reader["tradeno"].ToString().Trim(); goodsTradeLogInfo.Subject = reader["subject"].ToString().Trim(); goodsTradeLogInfo.Price = Convert.ToDecimal(reader["price"].ToString()); goodsTradeLogInfo.Quality = Convert.ToInt16(reader["quality"].ToString()); goodsTradeLogInfo.Categoryid = TypeConverter.ObjectToInt(reader["categoryid"]); goodsTradeLogInfo.Number = Convert.ToInt16(reader["number"].ToString()); goodsTradeLogInfo.Tax = Convert.ToDecimal(reader["tax"].ToString()); goodsTradeLogInfo.Locus = reader["locus"].ToString().Trim(); goodsTradeLogInfo.Sellerid = TypeConverter.ObjectToInt(reader["sellerid"]); goodsTradeLogInfo.Seller = reader["seller"].ToString().Trim(); goodsTradeLogInfo.Selleraccount = reader["selleraccount"].ToString().Trim(); goodsTradeLogInfo.Buyerid = TypeConverter.ObjectToInt(reader["buyerid"]); goodsTradeLogInfo.Buyer = reader["buyer"].ToString().Trim(); goodsTradeLogInfo.Buyercontact = reader["buyercontact"].ToString().Trim(); goodsTradeLogInfo.Buyercredit = Convert.ToInt16(reader["buyercredit"].ToString()); goodsTradeLogInfo.Buyermsg = reader["buyermsg"].ToString().Trim(); goodsTradeLogInfo.Status = Convert.ToInt16(reader["status"].ToString()); goodsTradeLogInfo.Lastupdate = Convert.ToDateTime(reader["lastupdate"].ToString()); goodsTradeLogInfo.Offline = Convert.ToInt16(reader["offline"].ToString()); goodsTradeLogInfo.Buyername = reader["buyername"].ToString().Trim(); goodsTradeLogInfo.Buyerzip = reader["buyerzip"].ToString().Trim(); goodsTradeLogInfo.Buyerphone = reader["buyerphone"].ToString().Trim(); goodsTradeLogInfo.Buyermobile = reader["buyermobile"].ToString().Trim(); goodsTradeLogInfo.Transport = Convert.ToInt16(reader["transport"].ToString()); goodsTradeLogInfo.Transportpay = Convert.ToInt16(reader["transportpay"].ToString()); goodsTradeLogInfo.Transportfee = Convert.ToDecimal(reader["transportfee"].ToString()); goodsTradeLogInfo.Tradesum = Convert.ToDecimal(reader["tradesum"].ToString()); goodsTradeLogInfo.Baseprice = Convert.ToDecimal(reader["baseprice"].ToString()); goodsTradeLogInfo.Discount = Convert.ToInt16(reader["discount"].ToString()); goodsTradeLogInfo.Ratestatus = Convert.ToInt16(reader["ratestatus"].ToString()); goodsTradeLogInfo.Message = reader["message"].ToString().Trim(); goodsTradeLogInfoColl.Add(goodsTradeLogInfo); } reader.Close(); return goodsTradeLogInfoColl; }
public void Insert(int index, Goodstradeloginfo value) { List.Insert(index, value); }
public void Remove(Goodstradeloginfo value) { List.Remove(value); }
/// <summary> /// 创建商品交易信息 /// </summary> /// <param name="goodstradelog">要创建的交易信息</param> /// <returns></returns> public int CreateGoodsTradeLog(Goodstradeloginfo goodsTradeLog) { DbParameter[] parms = { DbHelper.MakeInParam("@goodsid", (DbType)SqlDbType.Int, 4,goodsTradeLog.Goodsid), DbHelper.MakeInParam("@orderid", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Orderid), DbHelper.MakeInParam("@tradeno", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Tradeno), DbHelper.MakeInParam("@subject", (DbType)SqlDbType.NChar, 60,goodsTradeLog.Subject), DbHelper.MakeInParam("@price", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Price), DbHelper.MakeInParam("@quality", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Quality), DbHelper.MakeInParam("@categoryid", (DbType)SqlDbType.Int, 4,goodsTradeLog.Categoryid), DbHelper.MakeInParam("@number", (DbType)SqlDbType.SmallInt, 2,goodsTradeLog.Number), DbHelper.MakeInParam("@tax", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Tax), DbHelper.MakeInParam("@locus", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Locus), DbHelper.MakeInParam("@sellerid", (DbType)SqlDbType.Int, 4,goodsTradeLog.Sellerid), DbHelper.MakeInParam("@seller", (DbType)SqlDbType.NChar, 20,goodsTradeLog.Seller), DbHelper.MakeInParam("@selleraccount", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Selleraccount), DbHelper.MakeInParam("@buyerid", (DbType)SqlDbType.Int, 4,goodsTradeLog.Buyerid), DbHelper.MakeInParam("@buyer", (DbType)SqlDbType.NChar, 20,goodsTradeLog.Buyer), DbHelper.MakeInParam("@buyercontact", (DbType)SqlDbType.NChar, 100,goodsTradeLog.Buyercontact), DbHelper.MakeInParam("@buyercredit", (DbType)SqlDbType.SmallInt, 2,goodsTradeLog.Buyercredit), DbHelper.MakeInParam("@buyermsg", (DbType)SqlDbType.NChar, 100,goodsTradeLog.Buyermsg), DbHelper.MakeInParam("@status", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Status), DbHelper.MakeInParam("@lastupdate", (DbType)SqlDbType.DateTime, 8,goodsTradeLog.Lastupdate), DbHelper.MakeInParam("@offline", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Offline), DbHelper.MakeInParam("@buyername", (DbType)SqlDbType.NChar, 20,goodsTradeLog.Buyername), DbHelper.MakeInParam("@buyerzip", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Buyerzip), DbHelper.MakeInParam("@buyerphone", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Buyerphone), DbHelper.MakeInParam("@buyermobile", (DbType)SqlDbType.VarChar, 50,goodsTradeLog.Buyermobile), DbHelper.MakeInParam("@transport", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Transport), DbHelper.MakeInParam("@transportpay", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Transportpay), DbHelper.MakeInParam("@transportfee", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Transportfee), DbHelper.MakeInParam("@tradesum", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Tradesum), DbHelper.MakeInParam("@baseprice", (DbType)SqlDbType.Decimal, 18,goodsTradeLog.Baseprice), DbHelper.MakeInParam("@discount", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Discount), DbHelper.MakeInParam("@ratestatus", (DbType)SqlDbType.TinyInt, 1,goodsTradeLog.Ratestatus), DbHelper.MakeInParam("@message", (DbType)SqlDbType.NText, 0,goodsTradeLog.Message) }; string commandText = String.Format("INSERT INTO [{0}goodstradelogs] ([goodsid], [orderid], [tradeno], [subject], [price], [quality], [categoryid], [number], [tax], [locus], [sellerid], [seller], [selleraccount], [buyerid], [buyer], [buyercontact], [buyercredit], [buyermsg], [status], [lastupdate], [offline], [buyername], [buyerzip], [buyerphone], [buyermobile], [transport], [transportpay], [transportfee], [tradesum], [baseprice], [discount], [ratestatus], [message]) VALUES (@goodsid, @orderid, @tradeno, @subject, @price, @quality, @categoryid, @number, @tax, @locus, @sellerid, @seller, @selleraccount, @buyerid, @buyer, @buyercontact, @buyercredit, @buyermsg, @status, @lastupdate, @offline, @buyername, @buyerzip, @buyerphone, @buyermobile, @transport, @transportpay, @transportfee, @tradesum, @baseprice, @discount, @ratestatus, @message);SELECT SCOPE_IDENTITY() AS 'id'", BaseConfigs.GetTablePrefix); return TypeConverter.ObjectToInt(DbHelper.ExecuteDataset(CommandType.Text, commandText, parms).Tables[0].Rows[0][0], -1); }