Esempio n. 1
0
        /// <summary>
        /// 支付成功的后续事件
        /// </summary>
        public void ExecAfterPaid()
        {
            OrderService os = new OrderService();
            os.Initialize();

            U_UserInfo u = os.UserInfoBll.Get(this.UserId);
            TOrder o = os.TOrderBll.GetOrderAndDetail(this.OrderId);
            //检测订单状态
            CheckOrder(o, new OrderStatus[] { OrderStatus.NewOrder }, u);
            //更新订单状态
            os.TOrderBll.UpdateState2Paid(o.OrderId, this.Status, this.PayWay, this.PayDetail);

            //加入到我的购买
            DDocInfo buyDoc = os.DDocInfoBll.Get(o.OrderDetails[0].DocId);
            if (buyDoc != null)
            {
                MPurchase mp = new MPurchase()
                {
                    DocId = buyDoc.DocId,
                    Price = buyDoc.Price,
                    PurchaseTime = DateTime.Now,
                    UserId = this.UserId,
                    Title = buyDoc.Title,
                    Saler = buyDoc.UserId,
                    DocType = buyDoc.DocType
                };
                os.MPurchaseBll.Insert(mp);
                //给上传人返利
                AddAmountForUploader(o.OrderId, buyDoc.UserId, o.Total, os, buyDoc.DocId, buyDoc.Title, this.UserId, this.PayWay);
            }
            if (!string.IsNullOrEmpty(this.GotoUrl)) {
                HttpContext.Current.Response.Redirect(GotoUrl);
            }
        }