Example #1
0
        protected void listOrders_ItemCommand(object sender, GridViewCommandEventArgs e)
        {
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    if (TradeHelper.ConfirmOrderFinish(orderInfo))
                    {
                        this.BindOrders();
                        this.ShowMessage("成功的完成了该订单", true);
                    }
                    else
                    {
                        this.ShowMessage("完成订单失败", false);
                    }
                }
                if ((e.CommandName == "CLOSE_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_CLOSE))
                {
                    if (TradeHelper.CloseOrder(orderInfo.OrderId))
                    {
                        this.BindOrders();
                        this.ShowMessage("成功的关闭了该订单", true);
                    }
                    else
                    {
                        this.ShowMessage("关闭订单失败", false);
                    }
                }
            }
        }
Example #2
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2 = new DebitNoteInfo();;
                        info2 = new DebitNoteInfo {
                            NoteId   = Globals.GetGenerateId(),
                            OrderId  = e.CommandArgument.ToString(),
                            Operator = ManagerHelper.GetCurrentManager().UserName,
                            Remark   = "后台" + info2.Operator + "收款成功"
                        };
                        OrderHelper.SaveDebitNote(info2);
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if (e.CommandName == "FINISH_TRADE")
                {
                    orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE);
                }
            }
        }
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    if (orderInfo.GroupBuyId <= 0)
                    {
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info2 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info2 = pair.Value;
                        if ((info2.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info2.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            this.myNotifier.updateAction = UpdateAction.OrderUpdate;
                            this.myNotifier.actionDesc   = "订单已完成";
                            if (orderInfo.PayDate.HasValue)
                            {
                                this.myNotifier.RecDateUpdate = orderInfo.PayDate.Value;
                            }
                            else
                            {
                                this.myNotifier.RecDateUpdate = DateTime.Today;
                            }
                            this.myNotifier.DataUpdated += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                            this.myNotifier.UpdateDB();
                            this.ShowMsg("订单确认收货成功!", true);
                        }
                        else
                        {
                            this.ShowMsg("完成订单失败", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
Example #4
0
        protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    if (orderInfo.GroupBuyId > 0)
                    {
                        return;
                    }
                }
                else if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo lineItemInfo = new LineItemInfo();
                    foreach (System.Collections.Generic.KeyValuePair <string, LineItemInfo> current in lineItems)
                    {
                        lineItemInfo = current.Value;
                        if (lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForRefund || lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForReturns)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        return;
                    }
                    this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    return;
                }
                else
                {
                    if (e.CommandName == "delete")
                    {
                        string text = e.CommandArgument.ToString();
                        text = "'" + text.Replace(",", "','") + "'";
                        int num = OrderHelper.RealDeleteOrders(text);
                        this.BindOrders();
                        this.ShowMsg(string.Format("成功删除了{0}个订单", num), true);
                        return;
                    }
                    if (e.CommandName == "restore")
                    {
                        string text2 = e.CommandArgument.ToString();
                        text2 = "'" + text2.Replace(",", "','") + "'";
                        int num2 = OrderHelper.RestoreOrders(text2);
                        this.BindOrders();
                        this.ShowMsg(string.Format("成功还原了订单", num2), true);
                    }
                }
            }
        }
Example #5
0
        protected void listOrders_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    if (TradeHelper.ConfirmOrderFinish(orderInfo))
                    {
                        this.BindOrders();
                        this.ShowMessage("成功的完成了该订单", true, "", 1);
                        if (orderInfo.LineItems.Count > 0)
                        {
                            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                            if (masterSettings != null && masterSettings.ProductCommentPoint > 0)
                            {
                                Panel panel = (Panel)this.FindControl("panl_productcommentTip");
                                if (panel != null)
                                {
                                    panel.Visible = true;
                                    HiddenField hiddenField = (HiddenField)this.FindControl("goCommentLink");
                                    if (hiddenField != null)
                                    {
                                        hiddenField.Value = $"/user/OrderReviews/{orderInfo.OrderId}";
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        this.ShowMessage("完成订单失败,订单状态错误或者订单商品有退款、退货或者换货正在进行中!", false, "", 1);
                    }
                }
                if (e.CommandName == "CLOSE_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_CLOSE))
                {
                    if (TradeHelper.CloseOrder(orderInfo.OrderId, "会员主动关闭") && orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                    {
                        if (orderInfo.ShippingModeId == -2 && orderInfo.IsConfirm)
                        {
                            OrderHelper.CloseDeportOrderReturnStock(orderInfo, "会员" + HiContext.Current.User.UserName + "关闭订单");
                        }
                        Messenger.OrderClosed(HiContext.Current.User, orderInfo, "用户自己关闭订单");
                        this.BindOrders();
                        this.ShowMessage("成功的关闭了该订单", true, "", 1);
                    }
                    else
                    {
                        this.ShowMessage("关闭订单失败。", false, "", 1);
                    }
                }
            }
        }
Example #6
0
        /// <summary>
        /// 修改订单金额
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdateOrderAmount_Click(object sender, EventArgs e)
        {
            if (!order.CheckAction(OrderActions.SELLER_MODIFY_TRADE))
            {
                ShowMsg("你当前订单的状态不能进行修改订单费用操作", false);
            }
            else
            {
                decimal AdjustedFreight   = 0m;
                decimal AdjustedPayCharge = 0m;
                decimal AdjustedDiscount  = 0m;

                if (ValidateValues(out AdjustedFreight, out AdjustedPayCharge, out AdjustedDiscount))
                {
                    string msg = string.Empty;

                    order.AdjustedFreight   = AdjustedFreight;
                    order.AdjustedPayCharge = AdjustedPayCharge;
                    order.AdjustedDiscount  = AdjustedDiscount;

                    decimal total = order.GetTotal();

                    ValidationResults results = Hishop.Components.Validation.Validation.Validate <OrderInfo>(order, new string[] { "ValOrder" });
                    if (!results.IsValid)
                    {
                        foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                        {
                            msg = msg + Formatter.FormatErrorMessage(result.Message);
                            ShowMsg(msg, false);
                            return;
                        }
                    }
                    if (total > 0M)
                    {
                        if (OrderHelper.UpdateOrderAmount(order))
                        {
                            BindTatolAmount(order);
                            ShowMsg("成功的修改了订单金额", true);
                        }
                        else
                        {
                            ShowMsg("修改订单金额失败", false);
                        }
                    }
                    else
                    {
                        ShowMsg("订单的应付总金额不应该是负数,请重新输入订单折扣", false);
                    }
                }
            }
        }
Example #7
0
        protected void dlstOrders_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num2       = 0;
                    int num3       = 0;
                    int groupBuyId = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2 = new DebitNoteInfo();

                        info2.NoteId   = Globals.GetGenerateId();
                        info2.OrderId  = e.CommandArgument.ToString();
                        info2.Operator = ManagerHelper.GetCurrentManager().UserName;
                        info2.Remark   = "后台" + info2.Operator + "收款成功";

                        OrderHelper.SaveDebitNote(info2);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int num4 = num2 + num3;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    if (OrderHelper.ConfirmOrderFinish(orderInfo))
                    {
                        MemberProcessor.RemoveUserCache(orderInfo.UserId);
                        this.BindOrders();
                        DistributorsBrower.UpdateCalculationCommission(orderInfo);
                        this.ShowMsg("成功的完成了该订单", true);
                    }
                    else
                    {
                        this.ShowMsg("完成订单失败", false);
                    }
                }
            }
        }
Example #8
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     if (!order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS))
     {
         ShowMsg("当前订单状态没有订单礼品操作", false);
     }
     else if (!OrderHelper.ClearOrderGifts(order))
     {
         ShowMsg("清空礼品列表失败", false);
     }
     else
     {
         BindOrderGifts();
     }
 }
Example #9
0
        protected void btnConfirmPay_Click(object sender, EventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if ((orderInfo != null) && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                if (OrderHelper.ConfirmPay(orderInfo))
                {
                    DebitNoteInfo info2;
                    info2 = new DebitNoteInfo
                    {
                        NoteId   = Globals.GetGenerateId(),
                        OrderId  = this.orderId,
                        Operator = ManagerHelper.GetCurrentManager().UserName,
                        Remark   = "后台" + ManagerHelper.GetCurrentManager().UserName + "收款成功"
                    };
                    OrderHelper.SaveDebitNote(info2);
                    orderInfo.OnPayment();
                    this.ShowMsgAndReUrl("成功的确认了订单收款", true, "OrderDetails.aspx?OrderId=" + this.orderId + "&t=" + DateTime.Now.ToString("HHmmss"));
                }
                else
                {
                    this.ShowMsg("确认订单收款失败", false);
                }
            }
        }
Example #10
0
        public static bool ConfirmOrderFinish(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_FINISH_TRADE))
            {
                DateTime now = DateTime.Now;
                order.OrderStatus = OrderStatus.Finished;
                order.FinishDate  = new DateTime?(now);
                if (!order.PayDate.HasValue)
                {
                    order.PayDate = new DateTime?(now);
                }
                flag = new OrderDao().UpdateOrder(order, null);
                if (flag)
                {
                    EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "完成编号为\"{0}\"的订单", new object[]
                    {
                        order.OrderId
                    }));
                }
            }
            return(flag);
        }
Example #11
0
        private void FinishTrade(HttpContext context)
        {
            SiteSettings currentSiteSetting = base.CurrentSiteSetting;
            string       text = context.Request.Form["id"];

            if (string.IsNullOrWhiteSpace(text))
            {
                throw new HidistroAshxException("异常的参数:订单编号");
            }
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(text);

            if (orderInfo == null)
            {
                throw new HidistroAshxException("异常的参数:订单编号");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
            {
                return;
            }
            if (OrderHelper.ConfirmOrderFinish(orderInfo))
            {
                base.ReturnResult(context, true, "成功的完成了该订单", 0, true);
                return;
            }
            throw new HidistroAshxException("完成订单失败");
        }
Example #12
0
        public static bool CloseTransaction(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            bool result;

            if (order.CheckAction(OrderActions.SELLER_CLOSE))
            {
                order.OrderStatus = OrderStatus.Closed;
                bool flag = new OrderDao().UpdateOrder(order, null);
                if (flag)
                {
                    new OrderDao().UpdateItemsStatus(order.OrderId, 4, "all");
                    Point.SetPointByOrderId(order);
                    EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "关闭了订单“{0}”", new object[]
                    {
                        order.OrderId
                    }));
                }
                result = flag;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Example #13
0
        public static bool SendGoods(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.OrderSendGoods);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                OrderDao dao = new OrderDao();
                order.OrderStatus  = OrderStatus.SellerAlreadySent;
                order.ShippingDate = new DateTime?(DateTime.Now);
                flag = dao.UpdateOrder(order, null);
                if (!flag)
                {
                    return(flag);
                }
                if (order.Gateway.ToLower() == "hishop.plugins.payment.podrequest")
                {
                    dao.UpdatePayOrderStock(order.OrderId);
                    foreach (LineItemInfo info in order.LineItems.Values)
                    {
                        ProductDao  dao2           = new ProductDao();
                        ProductInfo productDetails = dao2.GetProductDetails(info.ProductId);
                        productDetails.SaleCounts     += info.Quantity;
                        productDetails.ShowSaleCounts += info.Quantity;
                        dao2.UpdateProduct(productDetails, null);
                    }
                    UpdateUserAccount(order);
                }
                EventLogs.WriteOperationLog(Privilege.OrderSendGoods, string.Format(CultureInfo.InvariantCulture, "发货编号为\"{0}\"的订单", new object[] { order.OrderId }));
            }
            return(flag);
        }
Example #14
0
        public static bool ConfirmPay(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.CofimOrderPay);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                OrderDao dao = new OrderDao();
                order.OrderStatus = OrderStatus.BuyerAlreadyPaid;
                order.PayDate     = new DateTime?(DateTime.Now);
                flag = dao.UpdateOrder(order, null);
                if (!flag)
                {
                    return(flag);
                }
                dao.UpdatePayOrderStock(order.OrderId);
                foreach (LineItemInfo info in order.LineItems.Values)
                {
                    ProductDao  dao2           = new ProductDao();
                    ProductInfo productDetails = dao2.GetProductDetails(info.ProductId);
                    productDetails.SaleCounts     += info.Quantity;
                    productDetails.ShowSaleCounts += info.Quantity;
                    dao2.UpdateProduct(productDetails, null);
                }
                UpdateUserAccount(order);
                Messenger.OrderPayment(new MemberDao().GetMember(order.UserId), order.OrderId, order.GetTotal());
                EventLogs.WriteOperationLog(Privilege.CofimOrderPay, string.Format(CultureInfo.InvariantCulture, "确认收款编号为\"{0}\"的订单", new object[] { order.OrderId }));
            }
            return(flag);
        }
Example #15
0
 protected override void AttachChildControls()
 {
     this.lblOrderId        = (System.Web.UI.WebControls.Label) this.FindControl("lblOrderId");
     this.lblOrderAmount    = (FormatedMoneyLabel)this.FindControl("lblOrderAmount");
     this.txtPassword       = (System.Web.UI.WebControls.TextBox) this.FindControl("txtPassword");
     this.litUseableBalance = (FormatedMoneyLabel)this.FindControl("litUseableBalance");
     this.btnPay            = ButtonManager.Create(this.FindControl("btnPay"));
     this.orderId           = this.Page.Request.QueryString["orderId"];
     PageTitle.AddSiteNameTitle("订单支付", HiContext.Current.Context);
     this.btnPay.Click += new System.EventHandler(this.btnPay_Click);
     if (string.IsNullOrEmpty(this.orderId))
     {
         base.GotoResourceNotFound();
     }
     if (!this.Page.IsPostBack)
     {
         Member member = Users.GetUser(HiContext.Current.User.UserId, false) as Member;
         if (!member.IsOpenBalance)
         {
             this.Page.Response.Redirect(Globals.ApplicationPath + string.Format("/user/OpenBalance.aspx?ReturnUrl={0}", System.Web.HttpContext.Current.Request.Url));
         }
         OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.orderId);
         if (!orderInfo.CheckAction(OrderActions.BUYER_PAY))
         {
             this.ShowMessage("当前的订单订单状态不是等待付款,所以不能支付", false);
             this.btnPay.Visible = false;
         }
         this.lblOrderId.Text         = orderInfo.OrderId;
         this.lblOrderAmount.Money    = orderInfo.GetTotal();
         this.litUseableBalance.Money = member.Balance - member.RequestBalance;
     }
 }
Example #16
0
 public static bool ConfirmOrderFinish(OrderInfo order)
 {
     try
     {
         ManagerHelper.CheckPrivilege(Privilege.EditOrders);
         bool flag = false;
         //特殊情况下直接跳过checkAction : 爽爽挝啡后台点餐,玖信健佳后台代理商进货
         if (order.CheckAction(OrderActions.SELLER_FINISH_TRADE) || CustomConfigHelper.Instance.AnonymousOrder || order.UserId.ToString().Substring(0, 5) == "99999")
         {
             order.OrderStatus = OrderStatus.Finished;
             order.FinishDate  = new DateTime?(DateTime.Now);
             flag = new OrderDao().UpdateOrder(order, null);
             if (flag)
             {
                 EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "完成编号为\"{0}\"的订单", new object[] { order.OrderId }));
             }
         }
         return(flag);
     }
     catch (Exception ex)
     {
         WriteLog(ex.Message);
         return(false);
     }
 }
Example #17
0
        public static bool CloseTransaction(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            if (!order.CheckAction(OrderActions.SELLER_CLOSE))
            {
                return(false);
            }
            order.OrderStatus = OrderStatus.Closed;
            bool flag = new OrderDao().UpdateOrder(order, null);

            if (order.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = GroupBuyHelper.GetGroupBuy(order.GroupBuyId);
                groupBuy.SoldCount -= order.GetGroupBuyProductQuantity();
                GroupBuyHelper.UpdateGroupBuy(groupBuy);
            }
            string itemStr = "'" + string.Join("','", order.LineItems.Keys) + "'";

            new OrderDao().UpdateItemsStatus(order.OrderId, 4, itemStr);
            if (flag)
            {
                EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "关闭了订单“{0}”", new object[] { order.OrderId }));
            }
            return(flag);
        }
Example #18
0
 public static bool ConfirmPay(OrderInfo order)
 {
     ManagerHelper.CheckPrivilege(Privilege.CofimOrderPay);
     bool flag = false;
     if (order.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
     {
         OrderDao dao = new OrderDao();
         order.OrderStatus = OrderStatus.BuyerAlreadyPaid;
         order.PayDate = new DateTime?(DateTime.Now);
         flag = dao.UpdateOrder(order, null);
         if (!flag)
         {
             return flag;
         }
         dao.UpdatePayOrderStock(order.OrderId);
         foreach (LineItemInfo info in order.LineItems.Values)
         {
             ProductDao dao2 = new ProductDao();
             ProductInfo productDetails = dao2.GetProductDetails(info.ProductId);
             productDetails.SaleCounts += info.Quantity;
             productDetails.ShowSaleCounts += info.Quantity;
             dao2.UpdateProduct(productDetails, null);
         }
         UpdateUserAccount(order);
         Messenger.OrderPayment(new MemberDao().GetMember(order.UserId), order.OrderId, order.GetTotal());
         EventLogs.WriteOperationLog(Privilege.CofimOrderPay, string.Format(CultureInfo.InvariantCulture, "确认收款编号为\"{0}\"的订单", new object[] { order.OrderId }));
     }
     return flag;
 }
Example #19
0
        public static bool ConfirmOrderFinish(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_FINISH_TRADE))
            {
                DateTime now = DateTime.Now;
                order.OrderStatus = OrderStatus.Finished;
                order.FinishDate  = new DateTime?(now);
                if (!order.PayDate.HasValue)
                {
                    order.PayDate = new DateTime?(now);
                }
                flag = new OrderDao().UpdateOrder(order, null);
                if (flag)
                {
                    EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "完成编号为\"{0}\"的订单", new object[] { order.OrderId }));
                }
            }
            if (flag)
            {
                DistributorsBrower.UpdateCalculationCommission(order);
                foreach (LineItemInfo info in order.LineItems.Values)
                {
                    if (info.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                    {
                        RefundHelper.UpdateOrderGoodStatu(order.OrderId, info.SkuId, 5, info.ID);
                    }
                }
            }
            return(flag);
        }
Example #20
0
        private void Add(HttpContext context)
        {
            int value  = base.GetIntParam(context, "giftId", false).Value;
            int value2 = base.GetIntParam(context, "quantity", false).Value;

            if (string.IsNullOrWhiteSpace(this.orderId))
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            if (value <= 0)
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            if (value2 <= 0)
            {
                throw new HidistroAshxException("礼品数量填写错误");
            }
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if (!orderInfo.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS))
            {
                throw new HidistroAshxException("当前订单状态没有订单礼品操作");
            }
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(value);

            if (giftDetails == null)
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            if (!OrderHelper.AddOrderGift(orderInfo, giftDetails, value2, 15.GetHashCode()))
            {
                throw new HidistroAshxException("添加订单礼品失败,可能礼品己存在");
            }
            base.ReturnSuccessResult(context, "操作成功!", 0, true);
        }
Example #21
0
 public static bool CreatePurchaseOrder(OrderInfo order)
 {
     if (order.CheckAction(OrderActions.SUBSITE_CREATE_PURCHASEORDER))
     {
         using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
         {
             connection.Open();
             DbTransaction dbTran = connection.BeginTransaction();
             try
             {
                 SubsiteSalesProvider provider      = SubsiteSalesProvider.Instance();
                 PurchaseOrderInfo    purchaseOrder = provider.ConvertOrderToPurchaseOrder(order);
                 if (!provider.CreatePurchaseOrder(purchaseOrder, dbTran))
                 {
                     dbTran.Rollback();
                     return(false);
                 }
                 dbTran.Commit();
                 return(true);
             }
             catch
             {
                 dbTran.Rollback();
                 return(false);
             }
             finally
             {
                 connection.Close();
             }
         }
     }
     return(false);
 }
Example #22
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    if (orderInfo.GroupBuyId <= 0)
                    {
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info2 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info2 = pair.Value;
                        if ((info2.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info2.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
                else if (e.CommandName == "delete")
                {
                    string str = e.CommandArgument.ToString();
                    int    num = OrderHelper.RealDeleteOrders("'" + str.Replace(",", "','") + "'");
                    this.BindOrders();
                    this.ShowMsg(string.Format("成功删除了{0}个订单", num), true);
                }
                else if (e.CommandName == "restore")
                {
                    string str2 = e.CommandArgument.ToString();
                    int    num2 = OrderHelper.RestoreOrders("'" + str2.Replace(",", "','") + "'");
                    this.BindOrders();
                    this.ShowMsg(string.Format("成功还原了订单", num2), true);
                }
            }
        }
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if ((orderInfo != null) && (e.CommandName == "FINISH_TRADE"))
            {
                orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE);
            }
        }
Example #24
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    if (orderInfo.GroupBuyId <= 0)
                    {
                    }
                }
                else if (e.CommandName == "FINISH_TRADE")
                {
                    orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE);
                }
            }
        }
Example #25
0
        protected void btnConfirmPay_Click(object sender, EventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if (orderInfo != null)
            {
                orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY);
            }
        }
Example #26
0
        public static bool ConfirmOrderCancel(OrderInfo order)
        {
            bool result = false;

            if (order.CheckAction(OrderActions.BUYER_CANCEL))
            {
                result = new OrderDao().CloseOrder(order.OrderId, CloseOrderType.Manually);
            }
            return(result);
        }
Example #27
0
        public static bool ConfirmOrderFinish(OrderInfo order)
        {
            bool flag = false;

            if (order.CheckAction(OrderActions.BUYER_CONFIRM_GOODS))
            {
                flag = TradeProvider.Instance().ConfirmOrderFinish(order);
            }
            return(flag);
        }
Example #28
0
        public static bool SendGoods(OrderInfo order)
        {
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                order.OrderStatus = OrderStatus.SellerAlreadySent;
                flag = SubsiteSalesProvider.Instance().SendGoods(order) > 0;
            }
            return(flag);
        }
Example #29
0
        public static bool ConfirmOrderFinish(OrderInfo order)
        {
            bool flag = false;

            if (order.CheckAction(OrderActions.BUYER_CONFIRM_GOODS) && (order.ItemStatus == OrderItemStatus.Nomarl))
            {
                order.OrderStatus = OrderStatus.Finished;
                order.FinishDate  = DateTime.Now;
                flag = new OrderDao().UpdateOrder(order, null);
            }
            return(flag);
        }
Example #30
0
        public static bool CloseOrder(string orderId)
        {
            OrderDao  dao       = new OrderDao();
            OrderInfo orderInfo = dao.GetOrderInfo(orderId);

            if (orderInfo.CheckAction(OrderActions.SELLER_CLOSE) && (orderInfo.ItemStatus == OrderItemStatus.Nomarl))
            {
                orderInfo.OrderStatus = OrderStatus.Closed;
                return(dao.UpdateOrder(orderInfo, null));
            }
            return(false);
        }
Example #31
0
        public static bool ConfirmPay(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.CofimOrderPay);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                OrderDao orderDao = new OrderDao();
                order.OrderStatus = OrderStatus.BuyerAlreadyPaid;
                order.PayDate     = new DateTime?(DateTime.Now);
                flag = orderDao.UpdateOrder(order, null);
                string text = "";
                if (flag)
                {
                    orderDao.UpdatePayOrderStock(order);
                    foreach (LineItemInfo current in order.LineItems.Values)
                    {
                        ProductDao productDao = new ProductDao();
                        text = text + "'" + current.SkuId + "',";
                        ProductInfo productDetails = productDao.GetProductDetails(current.ProductId);
                        productDetails.SaleCounts     += current.Quantity;
                        productDetails.ShowSaleCounts += current.Quantity;
                        productDao.UpdateProduct(productDetails, null);
                    }
                    if (!string.IsNullOrEmpty(text))
                    {
                        orderDao.UpdateItemsStatus(order.OrderId, 2, text.Substring(0, text.Length - 1));
                    }
                    if (!string.IsNullOrEmpty(order.ActivitiesId))
                    {
                        ActivitiesDao activitiesDao = new ActivitiesDao();
                        activitiesDao.UpdateActivitiesTakeEffect(order.ActivitiesId);
                    }
                    MemberHelper.SetOrderDate(order.UserId, 1);
                    try
                    {
                        if (order != null)
                        {
                            Messenger.SendWeiXinMsg_OrderPay(order);
                        }
                    }
                    catch (Exception var_8_180)
                    {
                    }
                    EventLogs.WriteOperationLog(Privilege.CofimOrderPay, string.Format(CultureInfo.InvariantCulture, "确认收款编号为\"{0}\"的订单", new object[]
                    {
                        order.OrderId
                    }));
                }
            }
            return(flag);
        }
Example #32
0
 public static bool ConfirmOrderFinish(OrderInfo order)
 {
     ManagerHelper.CheckPrivilege(Privilege.EditOrders);
     bool flag = false;
     if (order.CheckAction(OrderActions.SELLER_FINISH_TRADE))
     {
         order.OrderStatus = OrderStatus.Finished;
         order.FinishDate = new DateTime?(DateTime.Now);
         flag = new OrderDao().UpdateOrder(order, null);
         if (flag)
         {
             EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "完成编号为\"{0}\"的订单", new object[] { order.OrderId }));
         }
     }
     return flag;
 }
Example #33
0
 public static bool CloseTransaction(OrderInfo order)
 {
     ManagerHelper.CheckPrivilege(Privilege.EditOrders);
     if (order.CheckAction(OrderActions.SELLER_CLOSE))
     {
         order.OrderStatus = OrderStatus.Closed;
         bool flag = new OrderDao().UpdateOrder(order, null);
         if (order.GroupBuyId > 0)
         {
             GroupBuyInfo groupBuy = GroupBuyHelper.GetGroupBuy(order.GroupBuyId);
             groupBuy.SoldCount -= order.GetGroupBuyProductQuantity();
             GroupBuyHelper.UpdateGroupBuy(groupBuy);
         }
         if (flag)
         {
             EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "关闭了订单“{0}”", new object[] { order.OrderId }));
         }
         return flag;
     }
     return false;
 }
Example #34
0
 public static bool MondifyAddress(OrderInfo order)
 {
     ManagerHelper.CheckPrivilege(Privilege.EditOrders);
     if (order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_DELIVER_ADDRESS))
     {
         bool flag = new OrderDao().UpdateOrder(order, null);
         if (flag)
         {
             EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "修改了订单“{0}”的收货地址", new object[] { order.OrderId }));
         }
         return flag;
     }
     return false;
 }
Example #35
0
 public static bool UpdateOrderAmount(OrderInfo order)
 {
     ManagerHelper.CheckPrivilege(Privilege.EditOrders);
     bool flag = false;
     if (order.CheckAction(OrderActions.SELLER_MODIFY_TRADE))
     {
         flag = new OrderDao().UpdateOrder(order, null);
         if (flag)
         {
             EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "修改了编号为\"{0}\"订单的金额", new object[] { order.OrderId }));
         }
     }
     return flag;
 }
Example #36
0
 public static bool UpdateOrderShippingMode(OrderInfo order)
 {
     ManagerHelper.CheckPrivilege(Privilege.EditOrders);
     if (order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_SHIPPING_MODE))
     {
         bool flag = new OrderDao().UpdateOrder(order, null);
         if (flag)
         {
             EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "修改了订单“{0}”的配送方式", new object[] { order.OrderId }));
         }
         return flag;
     }
     return false;
 }
Example #37
0
 public static bool SendGoods(OrderInfo order)
 {
     ManagerHelper.CheckPrivilege(Privilege.OrderSendGoods);
     bool flag = false;
     if (order.CheckAction(OrderActions.SELLER_SEND_GOODS))
     {
         OrderDao dao = new OrderDao();
         order.OrderStatus = OrderStatus.SellerAlreadySent;
         order.ShippingDate = new DateTime?(DateTime.Now);
         flag = dao.UpdateOrder(order, null);
         if (!flag)
         {
             return flag;
         }
         if (order.Gateway.ToLower() == "hishop.plugins.payment.podrequest")
         {
             dao.UpdatePayOrderStock(order.OrderId);
             foreach (LineItemInfo info in order.LineItems.Values)
             {
                 ProductDao dao2 = new ProductDao();
                 ProductInfo productDetails = dao2.GetProductDetails(info.ProductId);
                 productDetails.SaleCounts += info.Quantity;
                 productDetails.ShowSaleCounts += info.Quantity;
                 dao2.UpdateProduct(productDetails, null);
             }
             UpdateUserAccount(order);
         }
         EventLogs.WriteOperationLog(Privilege.OrderSendGoods, string.Format(CultureInfo.InvariantCulture, "发货编号为\"{0}\"的订单", new object[] { order.OrderId }));
     }
     return flag;
 }