Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string str = base.Request.QueryString.Get("orderId");
     if (!string.IsNullOrEmpty(str))
     {
         OrderInfo orderInfo = OrderHelper.GetOrderInfo(str);
         if (orderInfo != null)
         {
             PackageInfo package = new PackageInfo {
                 Body = orderInfo.OrderId,
                 NotifyUrl = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host),
                 OutTradeNo = orderInfo.OrderId,
                 TotalFee = (int) (orderInfo.GetTotal() * 100M)
             };
             if (package.TotalFee < 1M)
             {
                 package.TotalFee = 1M;
             }
             string openId = "";
             MemberInfo currentMember = MemberProcessor.GetCurrentMember();
             if (currentMember != null)
             {
                 openId = currentMember.OpenId;
             }
             package.OpenId = openId;
             SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
             PayRequestInfo req = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey).BuildPayRequest(package);
             this.pay_json = this.ConvertPayJson(req);
         }
     }
 }
Пример #2
0
        private void btnSendGoods_Click(object sender, EventArgs e)
        {
            if (this.grdOrderGoods.Rows.Count <= 0)
            {
                this.ShowMsg("没有要进行发货的订单。", false);
            }
            else
            {
                DropdownColumn column = (DropdownColumn) this.grdOrderGoods.Columns[4];
                ListItemCollection selectedItems = column.SelectedItems;
                DropdownColumn column2 = (DropdownColumn) this.grdOrderGoods.Columns[5];
                ListItemCollection items2 = column2.SelectedItems;
                int num = 0;
                for (int i = 0; i < selectedItems.Count; i++)
                {
                    string orderId = (string) this.grdOrderGoods.DataKeys[this.grdOrderGoods.Rows[i].RowIndex].Value;
                    TextBox box = (TextBox) this.grdOrderGoods.Rows[i].FindControl("txtShippOrderNumber");
                    ListItem item = selectedItems[i];
                    ListItem item2 = items2[i];
                    int result = 0;
                    int.TryParse(item.Value, out result);
                    if ((!string.IsNullOrEmpty(box.Text.Trim()) && !string.IsNullOrEmpty(item.Value)) && ((int.Parse(item.Value) > 0) && !string.IsNullOrEmpty(item2.Value)))
                    {
                        OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId);
                        if ((((orderInfo.GroupBuyId <= 0) || (orderInfo.GroupBuyStatus == GroupBuyStatus.Success)) && (((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) && (orderInfo.Gateway == "hishop.plugins.payment.podrequest")) || (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid))) && (((result > 0) && !string.IsNullOrEmpty(box.Text.Trim())) && (box.Text.Trim().Length <= 20)))
                        {
                            ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(result, true);
                            orderInfo.RealShippingModeId = shippingMode.ModeId;
                            orderInfo.RealModeName = shippingMode.Name;
                            orderInfo.ExpressCompanyAbb = item2.Value;
                            orderInfo.ExpressCompanyName = item2.Text;
                            orderInfo.ShipOrderNumber = box.Text;
                            if (OrderHelper.SendGoods(orderInfo))
                            {
                                SendNoteInfo info3=new SendNoteInfo();

                                    info3.NoteId = Globals.GetGenerateId() + num;
                                    info3. OrderId = orderId;
                                    info3. Operator = ManagerHelper.GetCurrentManager().UserName;
                                    info3.Remark = "后台" + info3.Operator + "发货成功";

                                OrderHelper.SaveSendNote(info3);
                                if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0))
                                {
                                    if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                                    {
                                        PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                        if (paymentMode != null)
                                        {
                                            PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                        }
                                    }
                                    if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                                    {
                                        SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                                        PayClient client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                                        DeliverInfo deliver = new DeliverInfo {
                                            TransId = orderInfo.GatewayOrderId,
                                            OutTradeNo = orderInfo.OrderId,
                                            OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId
                                        };
                                        client.DeliverNotify(deliver);
                                    }
                                }
                                orderInfo.OnDeliver();
                                num++;
                            }
                        }
                    }
                }
                if (num == 0)
                {
                    this.ShowMsg("批量发货失败!", false);
                }
                else if (num > 0)
                {
                    this.BindData();
                    this.ShowMsg(string.Format("批量发货成功!发货数量{0}个", num), true);
                }
            }
        }
Пример #3
0
        private void btnSendGoods_Click(object sender, EventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);
            if (orderInfo != null)
            {
                ManagerInfo currentManager = ManagerHelper.GetCurrentManager();
                if (currentManager != null)
                {
                    if ((orderInfo.GroupBuyId > 0) && (orderInfo.GroupBuyStatus != GroupBuyStatus.Success))
                    {
                        this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                    }
                    else if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
                    {
                        this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                    }
                    else if (!this.radioShippingMode.SelectedValue.HasValue)
                    {
                        this.ShowMsg("请选择配送方式", false);
                    }
                    else if (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || (this.txtShipOrderNumber.Text.Trim().Length > 20))
                    {
                        this.ShowMsg("运单号码不能为空,在1至20个字符之间", false);
                    }
                    else if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue))
                    {
                        this.ShowMsg("请选择物流公司", false);
                    }
                    else
                    {
                        ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true);
                        orderInfo.RealShippingModeId = this.radioShippingMode.SelectedValue.Value;
                        orderInfo.RealModeName = shippingMode.Name;
                        ExpressCompanyInfo info4 = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue);
                        if (info4 != null)
                        {
                            orderInfo.ExpressCompanyAbb = info4.Kuaidi100Code;
                            orderInfo.ExpressCompanyName = info4.Name;
                        }
                        orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text;
                        if (OrderHelper.SendGoods(orderInfo))
                        {
                            SendNoteInfo info5 = new SendNoteInfo();

                            info5.NoteId = Globals.GetGenerateId();
                            info5.OrderId = this.orderId;
                            info5.Operator = currentManager.UserName;
                            info5.Remark = "后台" + info5.Operator + "发货成功";

                            OrderHelper.SaveSendNote(info5);
                            MemberInfo member = MemberHelper.GetMember(orderInfo.UserId);
                            Messenger.OrderShipping(orderInfo, member);
                            if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && (orderInfo.GatewayOrderId.Trim().Length > 0))
                            {
                                if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                                {
                                    PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                    if (paymentMode != null)
                                    {
                                        PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                    }
                                }
                                if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                                    PayClient client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                                    DeliverInfo deliver = new DeliverInfo
                                    {
                                        TransId = orderInfo.GatewayOrderId,
                                        OutTradeNo = orderInfo.OrderId,
                                        OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId
                                    };
                                    client.DeliverNotify(deliver);
                                }
                            }
                            orderInfo.OnDeliver();
                            this.ShowMsg("发货成功", true);
                        }
                        else
                        {
                            this.ShowMsg("发货失败", false);
                        }
                    }
                }
            }
        }