public bool CanConfirmOfflineReceipt(OrderModel order, bool isStore = true)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            bool         result         = false;

            if (order.OrderStatus == OrderStatus.WaitBuyerPay && order.Gateway != "hishop.plugins.payment.podrequest" && order.FightGroupId == 0)
            {
                result = (order.ShippingModeId != -2);
                if (masterSettings.OpenMultStore && order.ShippingModeId == -2 && order.PaymentTypeId != -3)
                {
                    result = true;
                }
                if (order.PreSaleId > 0)
                {
                    if (order.DepositDate.HasValue)
                    {
                        result = false;
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId);
                        if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && productPreSaleInfo.PaymentEndDate >= DateTime.Now)
                        {
                            result = true;
                        }
                    }
                }
                else if (!isStore)
                {
                    result = false;
                    if (order.ParentOrderId == "0" || order.ParentOrderId == "-1")
                    {
                        result = true;
                    }
                }
            }
            return(result);
        }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(this.Page.Request.QueryString["preSaleId"], out this.preSaleId))
     {
         base.GotoResourceNotFound();
     }
     else if (!this.Page.IsPostBack)
     {
         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.preSaleId);
         if (productPreSaleInfo == null || productPreSaleInfo.ProductId <= 0)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             Literal literal = this.litProductSaleAmount;
             int     num     = ProductPreSaleHelper.GetPreSaleProductAmount(this.preSaleId);
             literal.Text = num.ToString();
             Literal literal2 = this.litPayAllProductAmount;
             num           = ProductPreSaleHelper.GetPreSalePayFinalPaymentAmount(this.preSaleId);
             literal2.Text = num.ToString();
             this.litPayDepositTotal.Text   = ProductPreSaleHelper.GetPayDepositTotal(this.preSaleId).F2ToString("f2");
             this.litFinalPaymentTotal.Text = ProductPreSaleHelper.GetPayFinalPaymentTotal(this.preSaleId).F2ToString("f2");
             this.litAllTotal.Text          = (ProductPreSaleHelper.GetPayFinalPaymentTotal(this.preSaleId) + ProductPreSaleHelper.GetPayDepositTotal(this.preSaleId)).F2ToString("f2");
         }
     }
 }
Exemple #3
0
 private bool CheckPresaleInfo()
 {
     if (this.PresaleId > 0)
     {
         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.PresaleId);
         if (productPreSaleInfo == null)
         {
             this.ShowWapMessage("活动不存在!", "");
             return(false);
         }
         if (this.productSku.Split(',').Length > 1)
         {
             base.GotoResourceNotFound("");
             return(false);
         }
         if (!ProductPreSaleHelper.HasProductPreSaleInfo(this.productSku, this.PresaleId))
         {
             base.GotoResourceNotFound("");
             return(false);
         }
         return(true);
     }
     base.GotoResourceNotFound("");
     return(false);
 }
 public static bool CreatePreSale(ProductPreSaleInfo preSaleInfo)
 {
     if (preSaleInfo == null)
     {
         return(false);
     }
     Globals.EntityCoding(preSaleInfo, true);
     return(new PreSaleDao().Add(preSaleInfo, null) > 0);
 }
Exemple #5
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(base.Text))
            {
                base.Text = "我要咨询";
            }
            int num  = RouteConfig.GetParameter(this.Page, "countDownId", false).ToInt(0);
            int num2 = RouteConfig.GetParameter(this.Page, "groupBuyId", false).ToInt(0);
            int num3 = RouteConfig.GetParameter(this.Page, "PreSaleId", false).ToInt(0);

            if (num > 0)
            {
                CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num, 0);
                if (countDownInfo != null)
                {
                    base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new
                    {
                        countDownInfo.ProductId
                    });
                }
            }
            else if (num2 > 0)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num2);
                if (groupBuy != null)
                {
                    base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new
                    {
                        groupBuy.ProductId
                    });
                }
            }
            else if (num3 > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(num3);
                if (productPreSaleInfo != null)
                {
                    base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new
                    {
                        productPreSaleInfo.ProductId
                    });
                }
            }
            else
            {
                base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new
                {
                    ProductId = RouteConfig.GetParameter(this.Page, "productId", false)
                });
            }
            base.Render(writer);
        }
Exemple #6
0
        private void HasActivitiesToJumpUrl()
        {
            string        text          = string.Empty;
            CountDownInfo countDownInfo = PromoteHelper.ActiveCountDownByProductId(this.productId, 0);
            GroupBuyInfo  groupBuyInfo  = PromoteHelper.ActiveGroupBuyByProductId(this.productId);

            if (countDownInfo != null)
            {
                text = "/{0}/CountDownProductsDetails.aspx?countDownId=" + countDownInfo.CountDownId;
            }
            else if (groupBuyInfo != null)
            {
                text = "/{0}/GroupBuyProductDetails.aspx?groupBuyId=" + groupBuyInfo.GroupBuyId;
            }
            else
            {
                ProductPreSaleInfo productPreSaleInfoByProductId = ProductPreSaleHelper.GetProductPreSaleInfoByProductId(this.productId);
                if (productPreSaleInfoByProductId != null)
                {
                    text = "/{0}/PreSaleproductdetails.aspx?PreSaleId=" + productPreSaleInfoByProductId.PreSaleId;
                }
                else
                {
                    int activityStartsImmediatelyAboutCountDown = PromoteHelper.GetActivityStartsImmediatelyAboutCountDown(this.productId);
                    if (activityStartsImmediatelyAboutCountDown > 0)
                    {
                        this.aCountDownUrl.Text        = "该商品即将参与抢购活动,     去看看";
                        this.aCountDownUrl.NavigateUrl = this.FillStringURL("/{0}/CountDownProductsDetails.aspx?countDownId=" + activityStartsImmediatelyAboutCountDown);
                        this.aCountDownUrl.Style.Add("color", "red");
                        this.aCountDownUrl.Visible   = true;
                        this.divCountDownUrl.Visible = true;
                    }
                    else
                    {
                        int activityStartsImmediatelyAboutGroupBuy = PromoteHelper.GetActivityStartsImmediatelyAboutGroupBuy(this.productId);
                        if (activityStartsImmediatelyAboutGroupBuy > 0)
                        {
                            this.aCountDownUrl.Text        = "该商品即将参与团购活动,     去看看";
                            this.aCountDownUrl.NavigateUrl = this.FillStringURL("/{0}//GroupBuyProductDetails.aspx?groupBuyId=" + activityStartsImmediatelyAboutGroupBuy);
                            this.aCountDownUrl.Style.Add("color", "red");
                            this.aCountDownUrl.Visible   = true;
                            this.divCountDownUrl.Visible = true;
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.Page.Response.Redirect(this.FillStringURL(text));
            }
        }
Exemple #7
0
        public ProductPreSaleInfo GetPreSaleInfoWithNameAndPrice(int preSaleId)
        {
            string    query            = "select A.*,B.ProductName,(SELECT MIN(SalePrice) FROM dbo.Hishop_SKUs WHERE ProductId = A.ProductId) AS SalePrice from Hishop_ProductPreSale as A \r\nleft join Hishop_Products as B ON A.ProductId=B.ProductId Where A.PreSaleId=@PreSaleId";
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(query);

            base.database.AddInParameter(sqlStringCommand, "PreSaleId", DbType.Int32, preSaleId);
            ProductPreSaleInfo result = null;

            using (IDataReader objReader = base.database.ExecuteReader(sqlStringCommand))
            {
                result = DataHelper.ReaderToModel <ProductPreSaleInfo>(objReader);
            }
            return(result);
        }
Exemple #8
0
        public ProductPreSaleInfo GetProductPreSaleInfoByProductId(int ProductId)
        {
            string    query            = "select * from Hishop_ProductPreSale where PreSaleEndDate >= getdate() and ProductId = @ProductId";
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(query);

            base.database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, ProductId);
            ProductPreSaleInfo result = null;

            using (IDataReader objReader = base.database.ExecuteReader(sqlStringCommand))
            {
                result = DataHelper.ReaderToModel <ProductPreSaleInfo>(objReader);
            }
            return(result);
        }
Exemple #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         if (!int.TryParse(this.Page.Request.QueryString["preSaleId"], out this.preSaleId))
         {
             base.GotoResourceNotFound();
         }
         else
         {
             ProductPreSaleInfo preSaleInfoWithNameAndPrice = ProductPreSaleHelper.GetPreSaleInfoWithNameAndPrice(this.preSaleId);
             if (preSaleInfoWithNameAndPrice != null)
             {
                 this.lblProductName.Text = preSaleInfoWithNameAndPrice.ProductName;
                 this.lblSalePrice.Text   = "¥" + preSaleInfoWithNameAndPrice.SalePrice.F2ToString("f2");
                 if (preSaleInfoWithNameAndPrice.DepositPercent > 0)
                 {
                     this.lblDeposit.Text = preSaleInfoWithNameAndPrice.DepositPercent + "% (¥" + Math.Round(preSaleInfoWithNameAndPrice.SalePrice * (decimal)preSaleInfoWithNameAndPrice.DepositPercent / 100m, 2) + ")";
                 }
                 else if (preSaleInfoWithNameAndPrice.Deposit > decimal.Zero)
                 {
                     this.lblDeposit.Text = "¥" + preSaleInfoWithNameAndPrice.Deposit.ToString();
                 }
                 Label    label    = this.lblPreSaleEndDate;
                 DateTime dateTime = preSaleInfoWithNameAndPrice.PreSaleEndDate;
                 label.Text = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                 Label label2 = this.lblPaymentStartDate;
                 dateTime    = preSaleInfoWithNameAndPrice.PaymentStartDate;
                 label2.Text = dateTime.ToString("yyyy-MM-dd");
                 Label label3 = this.lblPaymentEndDate;
                 dateTime    = preSaleInfoWithNameAndPrice.PaymentEndDate;
                 label3.Text = dateTime.ToString("yyyy-MM-dd");
                 if (preSaleInfoWithNameAndPrice.DeliveryDays > 0)
                 {
                     this.lblDelivery.Text = "尾款支付后" + preSaleInfoWithNameAndPrice.DeliveryDays.ToString() + "天发货";
                 }
                 else if (preSaleInfoWithNameAndPrice.DeliveryDate.HasValue)
                 {
                     Label label4 = this.lblDelivery;
                     dateTime    = preSaleInfoWithNameAndPrice.DeliveryDate.Value;
                     label4.Text = dateTime.ToString("yyyy-MM-dd");
                 }
             }
             else
             {
                 base.GotoResourceNotFound();
             }
         }
     }
 }
        private void ActivityBusiness()
        {
            CountDownInfo      countDownInfo = PromoteHelper.ActiveCountDownByProductId(this.productId, 0);
            GroupBuyInfo       groupBuyInfo  = PromoteHelper.ActiveGroupBuyByProductId(this.productId);
            ProductPreSaleInfo productPreSaleInfoByProductId = ProductPreSaleHelper.GetProductPreSaleInfoByProductId(this.productId);

            if (countDownInfo != null)
            {
                this.Page.Response.Redirect("/CountDownProductsDetails.aspx?countDownId=" + countDownInfo.CountDownId);
            }
            else if (groupBuyInfo != null)
            {
                this.Page.Response.Redirect("/GroupBuyProductDetails.aspx?groupBuyId=" + groupBuyInfo.GroupBuyId);
            }
            else if (productPreSaleInfoByProductId != null && productPreSaleInfoByProductId.PreSaleEndDate >= DateTime.Now)
            {
                this.Page.Response.Redirect("/PreSaleProductDetails.aspx?PreSaleId=" + productPreSaleInfoByProductId.PreSaleId);
            }
            else
            {
                int activityStartsImmediatelyAboutCountDown = PromoteHelper.GetActivityStartsImmediatelyAboutCountDown(this.productId);
                if (activityStartsImmediatelyAboutCountDown > 0)
                {
                    this.aCountDownUrl.Text        = "该商品即将参与抢购活动,     去看看";
                    this.aCountDownUrl.NavigateUrl = "/CountDownProductsDetails.aspx?countDownId=" + activityStartsImmediatelyAboutCountDown;
                    this.aCountDownUrl.Style.Add("color", "red");
                    this.aCountDownUrl.Visible = true;
                }
                else
                {
                    int activityStartsImmediatelyAboutGroupBuy = PromoteHelper.GetActivityStartsImmediatelyAboutGroupBuy(this.productId);
                    if (activityStartsImmediatelyAboutGroupBuy > 0)
                    {
                        this.aCountDownUrl.Text        = "该商品即将参与团购活动,     去看看";
                        this.aCountDownUrl.NavigateUrl = "/GroupBuyProductDetails.aspx?groupBuyId=" + activityStartsImmediatelyAboutGroupBuy;
                        this.aCountDownUrl.Style.Add("color", "red");
                        this.aCountDownUrl.Visible = true;
                    }
                }
            }
        }
Exemple #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(this.Page.Request.QueryString["preSaleId"], out this.preSaleId))
     {
         base.GotoResourceNotFound();
     }
     else if (!this.Page.IsPostBack)
     {
         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.preSaleId);
         if (productPreSaleInfo == null || productPreSaleInfo.ProductId <= 0)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             this.hidProductId.Value = productPreSaleInfo.ProductId.ToString();
             string text = Globals.HostPath(HttpContext.Current.Request.Url) + "/ProductDetails.aspx?productId=" + productPreSaleInfo.ProductId;
             this.lblReferralsLink.Text = text;
         }
     }
 }
Exemple #12
0
        public void ConfirmPay(HttpContext context)
        {
            string text = context.Request["id"];

            if (string.IsNullOrWhiteSpace(text))
            {
                throw new HidistroAshxException("错误的编号");
            }
            OrderInfo orderInfo = new OrderDao().GetOrderInfo(text);

            if (orderInfo == null)
            {
                throw new HidistroAshxException("错误的编号");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                throw new HidistroAshxException("权限不足");
            }
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest");

            if (paymentMode != null)
            {
                orderInfo.Gateway       = paymentMode.Gateway;
                orderInfo.PaymentType   = paymentMode.Name;
                orderInfo.PaymentTypeId = paymentMode.ModeId;
            }
            else
            {
                orderInfo.Gateway       = "hishop.plugins.payment.bankrequest";
                orderInfo.PaymentType   = "线下支付";
                orderInfo.PaymentTypeId = 0;
            }
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            if (orderInfo.CountDownBuyId > 0)
            {
                string empty = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                {
                    CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                    if (countDownInfo == null)
                    {
                        throw new HidistroAshxException(empty);
                    }
                }
            }
            if (orderInfo.FightGroupId > 0)
            {
                string empty2 = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                {
                    FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2);
                    if (fightGroupActivityInfo == null)
                    {
                        throw new HidistroAshxException(empty2);
                    }
                }
            }
            if (orderInfo.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付");
                }
                num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                num  = groupBuy.MaxCount;
                num3 = orderInfo.GetGroupBuyOerderNumber();
                if (num < num2 + num3)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付");
                }
            }
            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    throw new HidistroAshxException("预售活动不存在");
                }
                if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                {
                    throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款");
                }
            }
            string empty3 = string.Empty;

            switch (TradeHelper.CheckOrderBeforePay(orderInfo, out empty3))
            {
            case 1:
                throw new HidistroAshxException($"当前有商品{empty3}下架或者被删除,不能确认收款");

            case 2:
                if ((orderInfo.PreSaleId <= 0 || orderInfo.DepositDate.HasValue) && orderInfo.PreSaleId > 0)
                {
                    break;
                }
                throw new HidistroAshxException($"当前有商品{empty3}库存不足,不能确认收款");
            }
            if (OrderHelper.ConfirmPay(orderInfo))
            {
                if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                {
                    PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                }
                if (orderInfo.ParentOrderId == "-1")
                {
                    OrderQuery orderQuery = new OrderQuery();
                    orderQuery.ParentOrderId = orderInfo.OrderId;
                    IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery);
                    foreach (OrderInfo item in listUserOrder)
                    {
                        OrderHelper.OrderConfirmPaySendMessage(item);
                    }
                }
                else
                {
                    OrderHelper.OrderConfirmPaySendMessage(orderInfo);
                }
                base.ReturnSuccessResult(context, "成功的确认了订单收款", 0, true);
                return;
            }
            throw new HidistroAshxException("确认订单收款失败");
        }
Exemple #13
0
        private DataGridViewModel <Dictionary <string, object> > GetDataList(OrderQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();

            if (query != null)
            {
                DbQueryResult orders = OrderHelper.GetOrders(query);
                dataGridViewModel.rows  = DataHelper.DataTableToDictionary(orders.Data);
                dataGridViewModel.total = orders.TotalRecords;
                string[] orderIds = (from d in dataGridViewModel.rows
                                     select d["OrderId"].ToString()).ToArray();
                List <RefundInfo> refundInfos = TradeHelper.GetRefundInfos(orderIds);
                foreach (Dictionary <string, object> row in dataGridViewModel.rows)
                {
                    OrderInfo order = TradeHelper.GetOrderInfo(row["OrderId"].ToString());
                    row.Add("OrderStatusText", OrderHelper.GetOrderStatusText(order.OrderStatus, order.ShippingModeId, order.IsConfirm, order.Gateway, 0, order.PreSaleId, order.DepositDate, false, order.ItemStatus, OrderType.NormalOrder));
                    row.Add("CanConfirmOrder", order.CanConfirmOrder());
                    row.Add("canCheckTake", order.CanConfirmTakeCode());
                    row.Add("canCloseOrder", this.CanClose(order, base.CurrentSiteSetting.OpenMultStore));
                    row.Add("canOfflineReceipt", OrderHelper.CanConfirmOfflineReceipt(order, false));
                    row.Add("CanEditPrice", this.CanEditPrice(order));
                    row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0));
                    bool flag = order.CanSendGoods(base.CurrentSiteSetting.OpenMultStore);
                    if (base.CurrentSiteSetting.OpenMultStore && order.StoreId != 0)
                    {
                        flag = false;
                    }
                    row.Add("canSendGoods", flag);
                    row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
                    bool flag2 = false;
                    if (base.CurrentSiteSetting.OpenMultStore && order.CountDownBuyId == 0 && order.BundlingId == 0 && order.ItemStatus == OrderItemStatus.Nomarl && (order.OrderStatus == OrderStatus.BuyerAlreadyPaid || (order.OrderStatus == OrderStatus.WaitBuyerPay && order.Gateway == "hishop.plugins.payment.podrequest")))
                    {
                        if (order.StoreId == -1)
                        {
                            flag2 = (order.LineItems.Count > 0);
                        }
                        else if (order.StoreId > 0)
                        {
                            flag2 = !order.IsConfirm;
                        }
                        else if (order.StoreId == 0)
                        {
                            flag2 = (order.ShippingModeId != -2 && order.LineItems.Count > 0);
                        }
                    }
                    row.Add("CanAllotStore", flag2);
                    RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId);
                    if (refundInfo != null)
                    {
                        row.Add("IsCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && !order.IsStoreCollect);
                        row.Add("RefundId", refundInfo.RefundId);
                    }
                    bool   flag3  = false;
                    string value  = string.Empty;
                    string value2 = string.Empty;
                    if (order.ItemStatus != 0 || order.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        if (refundInfo != null && order.OrderStatus == OrderStatus.ApplyForRefund)
                        {
                            flag3  = true;
                            value2 = "订单已申请退款";
                            value  = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId;
                        }
                        else
                        {
                            int            num            = 0;
                            AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                            int            num2           = 0;
                            foreach (LineItemInfo value4 in order.LineItems.Values)
                            {
                                if (value4.ReturnInfo != null || value4.ReplaceInfo != null)
                                {
                                    ReturnInfo  returnInfo  = value4.ReturnInfo;
                                    ReplaceInfo replaceInfo = value4.ReplaceInfo;
                                    if (num == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                    {
                                        if (value4.ReturnInfo != null)
                                        {
                                            afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                            num2           = value4.ReturnInfo.ReturnId;
                                        }
                                        else
                                        {
                                            afterSaleTypes = AfterSaleTypes.Replace;
                                            num2           = value4.ReplaceInfo.ReplaceId;
                                        }
                                    }
                                    num++;
                                }
                            }
                            if (order.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                            {
                                value2 = "订单中有商品正在退货/换货中";
                            }
                            else if (order.ReturnedCount > 0)
                            {
                                value2 = "订单中有商品已退货完成";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReplace)
                            {
                                value2 = "订单中有商品正在进行换货操作";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReturn)
                            {
                                value2 = "订单中有商品正在进行退货操作";
                            }
                            if (num > 0)
                            {
                                flag3 = true;
                                value = ((afterSaleTypes != AfterSaleTypes.ReturnAndRefund) ? ("ReplaceApplyDetail?ReplaceId=" + num2) : ("ReturnApplyDetail?ReturnId=" + num2));
                            }
                        }
                    }
                    row.Add("IsShowRefundIcon", flag3);
                    row.Add("RefundOperUrl", value);
                    row.Add("RefundTips", value2);
                    bool flag4 = false;
                    if (order.FightGroupId > 0)
                    {
                        FightGroupInfo fightGroup = VShopHelper.GetFightGroup(order.FightGroupId);
                        if (fightGroup != null)
                        {
                            row.Add("FightGroupActivityId", fightGroup.FightGroupActivityId);
                            if (fightGroup.Status == FightGroupStatus.FightGroupIn && order.OrderStatus != OrderStatus.WaitBuyerPay && order.OrderStatus != OrderStatus.Closed)
                            {
                                flag4 = true;
                            }
                        }
                    }
                    row.Add("FightGrouping", flag4);
                    if (order.StoreId > 0)
                    {
                        row.Add("StoreName", this.GetStoreName(order.StoreId));
                    }
                    if (order.LineItems.Count <= 0)
                    {
                        if (order.UserAwardRecordsId > 0)
                        {
                            row.Add("IsAwardOrder", true);
                        }
                        else
                        {
                            row.Add("IsGiftOrder", true);
                        }
                    }
                    if (order.PreSaleId > 0 && order.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId);
                        if (productPreSaleInfo != null)
                        {
                            string   value3 = "";
                            DateTime dateTime;
                            if (productPreSaleInfo.DeliveryDate.HasValue)
                            {
                                dateTime = productPreSaleInfo.DeliveryDate.Value;
                                value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                            }
                            else
                            {
                                DateTime payDate = order.PayDate;
                                if (order.PayDate != DateTime.MinValue)
                                {
                                    dateTime = order.PayDate;
                                    dateTime = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays);
                                    value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                                }
                            }
                            row.Add("SendGoodsTips", value3);
                        }
                    }
                }
            }
            return(dataGridViewModel);
        }
Exemple #14
0
        private void dlstOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                string       a = "";
                if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                {
                    a = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                }
                string          text             = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo       orderInfo        = TradeHelper.GetOrderInfo(text);
                OrderStatus     orderStatus      = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                int             num              = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                ImageLinkButton imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnPayOrder");
                Literal         literal          = (Literal)e.Item.FindControl("litCloseOrder");
                HyperLink       hyperLink        = (HyperLink)e.Item.FindControl("lkbtnEditPrice");
                int             num2             = (int)((DataBinder.Eval(e.Item.DataItem, "GroupBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "GroupBuyId"));
                int             num3             = (int)((DataBinder.Eval(e.Item.DataItem, "CountDownBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "CountDownBuyId"));
                int             num4             = (int)((DataBinder.Eval(e.Item.DataItem, "BundlingId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "BundlingId"));
                int             num5             = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
                Literal         literal2         = (Literal)e.Item.FindControl("litDivideStore");
                Literal         literal3         = (Literal)e.Item.FindControl("isGiftOrder");
                LinkButton      linkButton       = (LinkButton)e.Item.FindControl("lbtnFightGroup");
                Image           image            = (Image)e.Item.FindControl("imgError");
                HtmlAnchor      htmlAnchor       = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
                HtmlInputHidden htmlInputHidden  = (HtmlInputHidden)e.Item.FindControl("hidFightGroup");
                HtmlAnchor      htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("aftersaleImg");
                image.Visible = orderInfo.IsError;
                if (orderInfo.IsError)
                {
                    image.Attributes.Add("title", orderInfo.ErrorMessage);
                    image.ImageUrl = "\\Admin\\images\\orderError.png";
                }
                ProductPreSaleInfo productPreSaleInfo = null;
                if (orderInfo.PreSaleId > 0)
                {
                    Literal            literal4           = (Literal)e.Item.FindControl("litPreSale");
                    Literal            literal5           = (Literal)e.Item.FindControl("litSendGoods");
                    FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("lblOrderTotals");
                    e.Item.FindControl("lblAmount").Visible = true;
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    literal4.Text      = "<font>定金:" + orderInfo.Deposit.F2ToString("f2") + "</font>";
                    Literal literal6 = literal4;
                    literal6.Text            = literal6.Text + "<font>尾款:" + orderInfo.FinalPayment.F2ToString("f2") + "</font>";
                    literal4.Visible         = true;
                    formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment;
                    formatedMoneyLabel.Text  = (orderInfo.Deposit + orderInfo.FinalPayment).ToString();
                    if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        literal5.Visible = true;
                        DateTime dateTime;
                        if (productPreSaleInfo.DeliveryDate.HasValue)
                        {
                            Literal literal7 = literal5;
                            dateTime      = productPreSaleInfo.DeliveryDate.Value;
                            literal7.Text = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                        }
                        else
                        {
                            DateTime payDate = orderInfo.PayDate;
                            if (orderInfo.PayDate != DateTime.MinValue)
                            {
                                Literal literal8 = literal5;
                                dateTime      = orderInfo.PayDate;
                                dateTime      = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays);
                                literal8.Text = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                            }
                        }
                    }
                }
                RefundInfo refundInfo = TradeHelper.GetRefundInfo(orderInfo.OrderId);
                if (orderInfo.ItemStatus != 0 || orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                {
                    if (orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        if (refundInfo != null)
                        {
                            htmlAnchor2.Visible = true;
                            htmlAnchor2.Title   = "订单已申请退款";
                            htmlAnchor2.HRef    = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId;
                        }
                    }
                    else
                    {
                        int            num6           = 0;
                        AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                        int            num7           = 0;
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            if (value.ReturnInfo != null || value.ReplaceInfo != null)
                            {
                                ReturnInfo  returnInfo  = value.ReturnInfo;
                                ReplaceInfo replaceInfo = value.ReplaceInfo;
                                if (num6 == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                {
                                    if (value.ReturnInfo != null)
                                    {
                                        afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                        num7           = value.ReturnInfo.ReturnId;
                                    }
                                    else
                                    {
                                        afterSaleTypes = AfterSaleTypes.Replace;
                                        num7           = value.ReplaceInfo.ReplaceId;
                                    }
                                }
                                num6++;
                            }
                        }
                        if (orderInfo.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                        {
                            htmlAnchor2.Title = "订单中有商品正在退货/换货中";
                        }
                        else if (orderInfo.ReturnedCount > 0)
                        {
                            htmlAnchor2.Title = "订单中有商品已退货完成";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReplace)
                        {
                            htmlAnchor2.Title = "订单中有商品正在进行换货操作";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReturn)
                        {
                            htmlAnchor2.Title = "订单中有商品正在进行退货操作";
                        }
                        if (num6 > 0)
                        {
                            htmlAnchor2.Visible = true;
                            if (afterSaleTypes == AfterSaleTypes.ReturnAndRefund)
                            {
                                htmlAnchor2.HRef = "ReturnApplyDetail?ReturnId=" + num7;
                            }
                            else
                            {
                                htmlAnchor2.HRef = "ReplaceApplyDetail?ReplaceId=" + num7;
                            }
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                    if (fightGroup != null)
                    {
                        linkButton.PostBackUrl = "/Admin/promotion/FightGroupDetails.aspx?fightGroupActivityId=" + fightGroup.FightGroupActivityId;
                        if (fightGroup.Status == FightGroupStatus.FightGroupIn && orderInfo.OrderStatus != OrderStatus.WaitBuyerPay && orderInfo.OrderStatus != OrderStatus.Closed)
                        {
                            htmlInputHidden.Value = "1";
                        }
                        else
                        {
                            htmlInputHidden.Value = "0";
                        }
                    }
                }
                else
                {
                    linkButton.Visible = false;
                }
                OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                if (orderStatusLabel != null)
                {
                    orderStatusLabel.OrderItemStatus = orderInfo.ItemStatus;
                    if (orderInfo.PreSaleId > 0)
                    {
                        orderStatusLabel.PreSaleId   = orderInfo.PreSaleId;
                        orderStatusLabel.DepositDate = orderInfo.DepositDate;
                    }
                }
                HtmlAnchor htmlAnchor3 = (HtmlAnchor)e.Item.FindControl("lkbtnToDetail");
                int        num8        = (int)((DataBinder.Eval(e.Item.DataItem, "StoreId") == DBNull.Value) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "StoreId"));
                bool       flag        = (bool)((DataBinder.Eval(e.Item.DataItem, "IsStoreCollect") == DBNull.Value) ? ((object)false) : DataBinder.Eval(e.Item.DataItem, "IsStoreCollect"));
                bool       flag2       = false;
                if (refundInfo != null)
                {
                    htmlAnchor.HRef = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId.ToString();
                    flag2           = true;
                }
                if (orderInfo.LineItems.Count <= 0)
                {
                    literal3.Text = "(礼)";
                }
                Literal literal9 = (Literal)e.Item.FindControl("group");
                if (literal9 != null)
                {
                    if (num2 > 0)
                    {
                        literal9.Text = "(团)";
                    }
                    if (num3 > 0)
                    {
                        literal9.Text = "(抢)";
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        literal9.Text = "(预)";
                    }
                }
                if (orderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        if (!orderInfo.DepositDate.HasValue)
                        {
                            hyperLink.NavigateUrl = "javascript:DialogFrame('/Admin/sales/EditOrder.aspx?OrderId=" + text + "','修改订单价格',null,null,function(e){location.reload();})";
                            hyperLink.Visible     = true;
                            literal.Visible       = true;
                            if (a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                            {
                                imageLinkButton.Visible = true;
                            }
                        }
                        else if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && productPreSaleInfo.PaymentEndDate >= DateTime.Now && a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                    else
                    {
                        hyperLink.NavigateUrl = "javascript:DialogFrame('/Admin/sales/EditOrder.aspx?OrderId=" + text + "','修改订单价格',null,null,function(e){location.reload();})";
                        hyperLink.Visible     = true;
                        if (a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0 && (orderInfo.ParentOrderId == "0" || orderInfo.ParentOrderId == "-1"))
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                }
                if (a == "hishop.plugins.payment.podrequest")
                {
                    int num9;
                    switch (orderStatus)
                    {
                    case OrderStatus.SellerAlreadySent:
                        num9 = ((orderInfo.ParentOrderId == "0" || orderInfo.ParentOrderId == "-1") ? 1 : 0);
                        break;

                    default:
                        num9 = 0;
                        break;

                    case OrderStatus.WaitBuyerPay:
                        num9 = 1;
                        break;
                    }
                    if (num9 != 0)
                    {
                        literal.Visible = true;
                    }
                }
                if (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.StoreId > 0 && masterSettings.OpenMultStore)
                {
                    literal.Visible = false;
                }
                if (orderStatus == OrderStatus.ApplyForRefund && !orderInfo.IsStoreCollect)
                {
                    htmlAnchor.Visible = true;
                }
                imageLinkButton2.Visible = (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
                if (masterSettings.OpenMultStore && num == -2 && orderStatus == OrderStatus.WaitBuyerPay)
                {
                    literal.Visible   = !orderInfo.IsConfirm;
                    hyperLink.Visible = true;
                    if (a != "hishop.plugins.payment.podrequest" && orderInfo.PaymentTypeId != -3 && orderInfo.FightGroupId == 0)
                    {
                        imageLinkButton.Visible = true;
                    }
                }
            }
        }
Exemple #15
0
        private void GotoPay()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            OrderInfo    orderInfo      = ShoppingProcessor.GetOrderInfo(this.orderId);
            string       str            = "";

            if (orderInfo == null)
            {
                this.litErrorMsg.Text = "数据错误!";
            }
            else
            {
                if (orderInfo.PreSaleId > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    if (productPreSaleInfo == null)
                    {
                        this.litErrorMsg.Text = "预售活动不存在不能支付";
                        return;
                    }
                    if (!orderInfo.DepositDate.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                            return;
                        }
                        if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                        {
                            this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                            return;
                        }
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付尚未开始";
                            return;
                        }
                        DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                        if (t <= DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                            return;
                        }
                    }
                }
                else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                {
                    this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                    return;
                }
                if (orderInfo.CountDownBuyId > 0)
                {
                    string empty = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                        if (countDownInfo == null)
                        {
                            this.litErrorMsg.Text = empty;
                            return;
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    string empty2 = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2);
                        if (fightGroupActivityInfo == null)
                        {
                            this.litErrorMsg.Text = empty2;
                            return;
                        }
                    }
                }
                string  text   = orderInfo.OrderId;
                decimal amount = orderInfo.GetTotal(true);
                text = orderInfo.PayOrderId;
                if (orderInfo.PreSaleId > 0)
                {
                    if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        amount = orderInfo.Deposit;
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        amount = orderInfo.FinalPayment;
                    }
                }
                this.litErrorMsg.Text = "";
                if (orderInfo.Gateway == "hishop.plugins.payment.advancerequest")
                {
                    this.Page.Response.Redirect("TransactionPwd?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + orderInfo.GetTotal(false).F2ToString("f2"));
                }
                if (orderInfo.Gateway == "hishop.plugins.payment.ws_apppay.wswappayrequest")
                {
                    HttpContext.Current.Response.Redirect("~/pay/app_alipay_Submit?orderId=" + orderInfo.OrderId);
                }
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.Gateway);
                if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                {
                    if (!masterSettings.EnableAppWapAliPay)
                    {
                        this.litErrorMsg.Text = "未开启支付宝网页支付";
                    }
                    else
                    {
                        string         attach         = "";
                        string         showUrl        = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/MemberOrderDetails?orderId={orderInfo.OrderId}";
                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url"), Globals.FullPath("/pay/wap_alipay_notify_url"), attach);
                        paymentRequest.SendRequest();
                    }
                }
                else if (orderInfo.Gateway == "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest")
                {
                    if (!masterSettings.EnableAppShengPay)
                    {
                        this.litErrorMsg.Text = "未开启盛付通手机网页支付";
                    }
                    else
                    {
                        string         attach2         = "";
                        string         text2           = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/";
                        PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, text2, text2 + "MemberOrderDetails?orderId=" + orderInfo.OrderId, Globals.FullPath("/pay/wap_sheng_return_url"), attach2);
                        paymentRequest2.SendRequest();
                    }
                }
                else if (orderInfo.Gateway == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                {
                    if (!masterSettings.EnableAPPBankUnionPay)
                    {
                        this.litErrorMsg.Text = "未开启银联全渠道支付";
                    }
                    else
                    {
                        string         attach3         = "";
                        string         showUrl2        = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/";
                        PaymentRequest paymentRequest3 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl2, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach3);
                        paymentRequest3.SendRequest();
                    }
                }
                else
                {
                    if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest" || orderInfo.Gateway == "hishop.plugins.payment.appwxrequest")
                    {
                        if (!masterSettings.OpenAppWxPay || string.IsNullOrEmpty(masterSettings.AppWxAppId) || string.IsNullOrEmpty(masterSettings.AppWxAppSecret) || string.IsNullOrEmpty(masterSettings.AppWxMchId) || string.IsNullOrEmpty(masterSettings.AppWxPartnerKey))
                        {
                            this.litErrorMsg.Text = "APP未开通微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit?orderId=" + orderInfo.OrderId);
                    }
                    if (paymentMode == null)
                    {
                        this.litErrorMsg.Text = "错误的支付方式";
                    }
                    else
                    {
                        this.litErrorMsg.Text = "APP不支持使用" + paymentMode.Name + "进行支付";
                    }
                }
            }
        }
Exemple #16
0
        protected override void AttachChildControls()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       empty          = string.Empty;

            this.spandemo         = (HtmlGenericControl)this.FindControl("spandemo");
            this.spandemo.Visible = masterSettings.IsDemoSite;
            this.litShipTo        = (Literal)this.FindControl("litShipTo");
            this.litCellPhone     = (Literal)this.FindControl("litCellPhone");
            this.litAddress       = (Literal)this.FindControl("litAddress");
            this.rptCartProducts  = (Common_SubmmitCartProducts)this.FindControl("Common_SubmmitCartProducts");
            this.rptCartProducts.ItemDataBound += this.rptCartProducts_ItemDataBound;
            this.rptCartGifts                = (WapTemplatedRepeater)this.FindControl("rptCartGifts");
            this.rptCartPointGifts           = (WapTemplatedRepeater)this.FindControl("rptCartPointGifts");
            this.divGifts                    = (HtmlGenericControl)this.FindControl("divGifts");
            this.dropCoupon                  = (Common_CouponSelect)this.FindControl("dropCoupon");
            this.lblOrderTotal               = (Label)this.FindControl("lblOrderTotal");
            this.groupbuyHiddenBox           = (HtmlInputControl)this.FindControl("groupbuyHiddenBox");
            this.countdownHiddenBox          = (HtmlInputControl)this.FindControl("countdownHiddenBox");
            this.fightGroupHiddenBox         = (HtmlInputControl)this.FindControl("fightGroupHiddenBox");
            this.fightGroupActivityHiddenBox = (HtmlInputControl)this.FindControl("fightGroupActivityHiddenBox");
            this.lblTotalPrice               = (HtmlGenericControl)this.FindControl("lblTotalPrice");
            this.lblTotalPrice1              = (HtmlGenericControl)this.FindControl("lblTotalPrice1");
            this.lblTax                    = (HtmlGenericControl)this.FindControl("lblTax");
            this.rptPromotions             = (WapTemplatedRepeater)this.FindControl("rptPromotions");
            this.rptShippingType           = (WapTemplatedRepeater)this.FindControl("rptShippingType");
            this.paymenttypeselect         = (Common_WAPPaymentTypeSelect)this.FindControl("paymenttypeselect");
            this.hidIsMultiStore           = (HtmlInputHidden)this.FindControl("hidIsMultiStore");
            this.hdCurrentckIds            = (HtmlInputControl)this.FindControl("hdCurrentckIds");
            this.hidShoppingDeduction      = (HtmlInputHidden)this.FindControl("hidShoppingDeduction");
            this.hidCanPointUseWithCoupon  = (HtmlInputHidden)this.FindControl("hidCanPointUseWithCoupon");
            this.lblMaxPoints              = (Label)this.FindControl("lblMaxPoints");
            this.hidTotalPrice             = (HtmlInputHidden)this.FindControl("hidTotalPrice");
            this.txtUsePoints              = (HtmlInputText)this.FindControl("txtUsePoint");
            this.hidShoppingDeductionRatio = (HtmlInputHidden)this.FindControl("hidShoppingDeductionRatio");
            this.hidMyPoints               = (HtmlInputHidden)this.FindControl("hidMyPoints");
            this.hidOrderRate              = (HtmlInputHidden)this.FindControl("hidOrderRate");
            this.inputPaymentModeId        = (HtmlInputHidden)this.FindControl("inputPaymentModeId");
            this.hidStoreId                = (HtmlInputHidden)this.FindControl("hidStoreId");
            this.hidChooseStoreId          = (HtmlInputHidden)this.FindControl("hidChooseStoreId");
            this.hidStoreName              = (HtmlInputHidden)this.FindControl("hidStoreName");
            this.lblMaxPointsToPrice       = (Label)this.FindControl("lblMaxPointsToPrice");
            this.lblDeductibleMoney        = (HtmlGenericControl)this.FindControl("lblDeductibleMoney");
            this.litTaxRate                = (Label)this.FindControl("litTaxRate");
            this.hlkFeeFreight             = (HyperLink)this.FindControl("hlkFeeFreight");
            this.hlkReducedPromotion       = (HyperLink)this.FindControl("hlkReducedPromotion");
            this.rptOrderCoupon            = (WapTemplatedRepeater)this.FindControl("rptOrderCoupon");
            this.htmlCouponCode            = (HtmlInputHidden)this.FindControl("htmlCouponCode");
            this.couponName                = (HtmlGenericControl)this.FindControl("couponName");
            this.litCouponAmout            = (HtmlGenericControl)this.FindControl("litCouponAmout");
            this.hidCanUsePoint            = (HtmlInputHidden)this.FindControl("hidCanUsePoint");
            this.divTax                    = (HtmlGenericControl)this.FindControl("divTax");
            this.spanTaxRate               = (HtmlGenericControl)this.FindControl("spanTaxRate");
            this.lblGiftFeright            = (Label)this.FindControl("lblGiftFeright");
            this.hidHasSupplierProduct     = (HtmlInputHidden)this.FindControl("hidHasSupplierProduct");
            this.hidPointRate              = (HtmlInputHidden)this.FindControl("hidPointRate");
            this.divlinegifts              = (HtmlGenericControl)this.FindControl("divlinegifts");
            this.hidOnlinePayCount         = (HtmlInputHidden)this.FindControl("hidOnlinePayCount");
            this.hidHasStoresInCity        = (HtmlInputHidden)this.FindControl("hidHasStoresInCity");
            this.hidPaymentId_Offline      = (HtmlInputHidden)this.FindControl("hidPaymentId_Offline");
            this.storeName                 = (HtmlGenericControl)this.FindControl("storeName");
            this.storeTel                  = (HtmlGenericControl)this.FindControl("storeTel");
            this.storeAddress              = (HtmlGenericControl)this.FindControl("storeAddress");
            this.storeTime                 = (HtmlGenericControl)this.FindControl("storeTime");
            this.storeDistance             = (HtmlGenericControl)this.FindControl("storeDistance");
            this.hidIsSubmitInTime         = (HtmlInputHidden)this.FindControl("hidIsSubmitInTime");
            this.hidInputItemsJson         = (HtmlInputHidden)this.FindControl("hidInputItemsJson");
            this.hidInvoiceType            = (HtmlInputHidden)this.FindControl("hidInvoiceType");
            this.hidInvoiceTitle           = (HtmlInputHidden)this.FindControl("hidInvoiceTitle");
            this.hidInvoiceTaxpayerNumber  = (HtmlInputHidden)this.FindControl("hidInvoiceTaxpayerNumber");
            this.hidOpenBalancePay         = (HtmlInputHidden)this.FindControl("hidOpenBalancePay");
            this.hidBalanceAmount          = (HtmlInputHidden)this.FindControl("hidBalanceAmount");
            this.lblBalance                = (Label)this.FindControl("lblBalance");
            this.hidEnableTax              = (HtmlInputHidden)this.FindControl("hidEnableTax");
            this.hidEnableETax             = (HtmlInputHidden)this.FindControl("hidEnableETax");
            this.hidEnableVATTax           = (HtmlInputHidden)this.FindControl("hidEnableVATTax");
            this.hidVATTaxRate             = (HtmlInputHidden)this.FindControl("hidVATTaxRate");
            this.hidTaxRate                = (HtmlInputHidden)this.FindControl("hidTaxRate");
            this.hidVATInvoiceDays         = (HtmlInputHidden)this.FindControl("hidVATInvoiceDays");
            this.litAfterSaleDays          = (Literal)this.FindControl("litAfterSaleDays");
            this.litInvoiceSendDays        = (Literal)this.FindControl("litInvoiceSendDays");
            this.hidInvoiceId              = (HtmlInputHidden)this.FindControl("hidInvoiceId");
            this.hidIsPersonal             = (HtmlInputHidden)this.FindControl("hidIsPersonal");
            this.hidInvoiceType            = (HtmlInputHidden)this.FindControl("hidInvoiceType");
            this.hidInvoiceJson            = (HtmlInputHidden)this.FindControl("hidInvoiceJson");
            this.hidInvoiceTitle           = (HtmlInputHidden)this.FindControl("hidInvoiceTitle");
            this.hidInvoiceTaxpayerNumber  = (HtmlInputHidden)this.FindControl("hidInvoiceTaxpayerNumber");
            this.hidOpenBalancePay.Value   = masterSettings.OpenBalancePay.ToNullString().ToLower();
            HtmlInputHidden htmlInputHidden = this.hidEnableETax;
            bool            flag            = masterSettings.EnableTax;

            htmlInputHidden.Value = flag.ToString().ToLower();
            HtmlInputHidden htmlInputHidden2 = this.hidEnableTax;

            flag = masterSettings.EnableE_Invoice;
            htmlInputHidden2.Value = flag.ToString().ToLower();
            HtmlInputHidden htmlInputHidden3 = this.hidEnableVATTax;

            flag = masterSettings.EnableVATInvoice;
            htmlInputHidden3.Value       = flag.ToString().ToLower();
            this.hidVATTaxRate.Value     = masterSettings.VATTaxRate.ToNullString();
            this.hidTaxRate.Value        = masterSettings.TaxRate.ToNullString();
            this.hidVATInvoiceDays.Value = masterSettings.VATInvoiceDays.ToNullString();
            this.litAfterSaleDays.SetWhenIsNotNull(masterSettings.EndOrderDays.ToNullString());
            this.litInvoiceSendDays.SetWhenIsNotNull((masterSettings.EndOrderDays + masterSettings.VATInvoiceDays).ToNullString());
            this.hidOpenBalancePay.Value = masterSettings.OpenBalancePay.ToNullString().ToLower();
            this.hidIsPreSale            = (HtmlInputHidden)this.FindControl("hidIsPreSale");
            this.lblAmount           = (HtmlGenericControl)this.FindControl("lblAmount");
            this.lblDepositMoney     = (HtmlGenericControl)this.FindControl("lblDepositMoney");
            this.lblRetainage        = (HtmlGenericControl)this.FindControl("lblRetainage");
            this.hidHasTradePassword = (HtmlInputHidden)this.FindControl("hidHasTradePassword");
            this.hidIsGeneralMuti    = (HtmlInputHidden)this.FindControl("hidIsGeneralMuti");
            if (this.hidPointRate != null)
            {
                this.hidPointRate.Value = HiContext.Current.SiteSettings.PointsRate.F2ToString("f2");
            }
            this.buyAmount                = this.Page.Request.QueryString["buyAmount"].ToInt(0);
            this.productSku               = this.Page.Request.QueryString["productSku"].ToNullString();
            this.groupBuyId               = this.Page.Request.QueryString["groupBuyId"].ToInt(0);
            this.countDownId              = this.Page.Request.QueryString["countdownId"].ToInt(0);
            this.fightGroupActivityId     = this.Page.Request.QueryString["fightGroupActivityId"].ToInt(0);
            this.fightGroupId             = this.Page.Request.QueryString["fightGroupId"].ToInt(0);
            this.hidHasStoresInCity.Value = "false";
            if (this.buyAmount > 0 && !string.IsNullOrEmpty(this.productSku) && !string.IsNullOrEmpty(this.from) && (this.from == "signbuy" || this.from == "groupbuy" || this.from == "countdown" || this.from == "fightgroup" || this.from == "presale"))
            {
                if (this.isGroupBuy)
                {
                    this.groupbuyHiddenBox.SetWhenIsNotNull(this.groupBuyId.ToString());
                    this.cart = ShoppingCartProcessor.GetGroupBuyShoppingCart(this.productSku, this.buyAmount);
                }
                else if (this.isCountDown)
                {
                    this.countdownHiddenBox.SetWhenIsNotNull(this.countDownId.ToString());
                }
                else if (this.isFightGroup)
                {
                    this.fightGroupHiddenBox.SetWhenIsNotNull(this.fightGroupId.ToString());
                    this.fightGroupActivityHiddenBox.SetWhenIsNotNull(this.fightGroupActivityId.ToString());
                }
                else if (this.isPreSale)
                {
                    this.hidIsPreSale.Value = "1";
                    this.FindControl("ulpresale").Visible = true;
                }
                this.hdCurrentckIds.Value = this.productSku;
            }
            else
            {
                string value = string.Empty;
                if (string.IsNullOrEmpty(this.productSku))
                {
                    HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["ckids"];
                    if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
                    {
                        value = Globals.UrlDecode(httpCookie.Value);
                    }
                }
                else
                {
                    value = this.productSku;
                }
                this.hdCurrentckIds.Value = value;
            }
            if (this.cart != null && ((this.cart.LineItems != null && this.cart.LineItems.Count > 0) || (this.cart.LineGifts != null && this.cart.LineGifts.Count > 0)))
            {
                if (!TradeHelper.CheckShoppingStock(this.cart, out empty, this.storeId))
                {
                    this.ShowWapMessage("订单中有商品(" + empty + ")库存不足", "ShoppingCart.aspx");
                }
                this.hidOnlinePayCount.Value = TradeHelper.WapPaymentTypeCount(base.ClientType, this.isFightGroup).ToNullString();
                this.bindShippingPaymentInfo();
                this.divTax.Visible = false;
                Label   label = this.litTaxRate;
                decimal num   = masterSettings.TaxRate;
                label.Text = num.ToString(CultureInfo.InvariantCulture);
                this.spanTaxRate.Visible = (masterSettings.TaxRate > decimal.Zero);
                this.hidOrderRate.Value  = ((masterSettings.TaxRate > decimal.Zero) ? (this.cart.GetTotal(this.storeId > 0) * masterSettings.TaxRate / 100m).F2ToString("f2") : "0.00");
                MemberInfo user = Users.GetUser(HiContext.Current.UserId);
                this.hidHasTradePassword.Value = (string.IsNullOrWhiteSpace(user.TradePassword) ? "0" : "1");
                this.hidBalanceAmount.Value    = (user.Balance - user.RequestBalance).F2ToString("f2");
                this.lblBalance.Text           = (user.Balance - user.RequestBalance).F2ToString("f2");
                this.bindCouponInfo();
                this.rptCartProducts.RegionId = this.userRegionId;
                var dataSource = (from i in (from i in this.cart.LineItems
                                             select new
                {
                    i.SupplierId,
                    i.SupplierName
                }).Distinct()
                                  orderby i.SupplierId
                                  select i).ToList();
                this.rptCartProducts.DataSource   = dataSource;
                this.rptCartProducts.ShoppingCart = this.cart;
                this.rptCartProducts.StoreId      = this.storeId;
                this.rptCartProducts.DataBind();
                if ((from i in this.cart.LineItems
                     where i.SupplierId == 0
                     select i).Count() <= 0)
                {
                    this.divTax.Visible = false;
                }
                if ((from i in this.cart.LineItems
                     where i.SupplierId > 0
                     select i).Count() > 0)
                {
                    this.hidHasSupplierProduct.Value = "1";
                }
                if (this.isPreSale)
                {
                    decimal            num2 = default(decimal);
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.PresaleId);
                    if (this.cart != null)
                    {
                        num2 = ((productPreSaleInfo.Deposit == decimal.Zero) ? (this.cart.LineItems[0].MemberPrice * (decimal)productPreSaleInfo.DepositPercent / 100m) : productPreSaleInfo.Deposit) * (decimal)this.cart.LineItems[0].Quantity;
                    }
                    this.lblTotalPrice.InnerHtml = this.cart.GetAmount(false).F2ToString("f2");
                    HtmlGenericControl htmlGenericControl = this.lblTotalPrice1;
                    Label  label2 = this.lblOrderTotal;
                    string text3  = htmlGenericControl.InnerText = (label2.Text = num2.F2ToString("f2"));
                    this.lblDepositMoney.InnerText = num2.F2ToString("f2");
                    decimal num3 = this.cart.GetTotal(false) - num2;
                    if (num3 < decimal.Zero)
                    {
                        num3 = default(decimal);
                    }
                    this.lblRetainage.InnerText = num3.F2ToString("f2");
                    this.lblAmount.InnerText    = (num2 + num3).F2ToString("f2");
                    HtmlInputHidden htmlInputHidden4 = this.hidTotalPrice;
                    num = this.cart.GetTotal(false);
                    htmlInputHidden4.Value = num.ToString();
                }
                else
                {
                    HtmlInputHidden    htmlInputHidden5    = this.hidTotalPrice;
                    Label              label3              = this.lblOrderTotal;
                    string             text3               = htmlInputHidden5.Value = (label3.Text = this.cart.GetTotal(this.storeId > 0).F2ToString("f2"));
                    HtmlGenericControl htmlGenericControl2 = this.lblTotalPrice1;
                    HtmlGenericControl htmlGenericControl3 = this.lblTotalPrice;
                    text3 = (htmlGenericControl2.InnerText = (htmlGenericControl3.InnerHtml = this.cart.GetAmount(this.storeId > 0).F2ToString("f2")));
                }
                if (this.cart != null)
                {
                    this.BindSendGifts();
                    if (this.storeId <= 0)
                    {
                        this.BindPointGifts();
                    }
                }
                this.hidCanPointUseWithCoupon.Value = "false";
                this.hidCanUsePoint.Value           = "false";
                bool flag2 = true;
                if (this.isGroupBuy || this.isCountDown || this.cart.LineItems.Count == 0 || this.isFightGroup)
                {
                    flag2 = false;
                }
                if (flag2 && user != null && masterSettings.ShoppingDeduction > 0 && user.Points > 0)
                {
                    int     shoppingDeductionRatio = masterSettings.ShoppingDeductionRatio;
                    decimal num4 = (decimal)shoppingDeductionRatio * this.cart.GetTotal(this.storeId > 0) * (decimal)masterSettings.ShoppingDeduction / 100m;
                    int     num5 = ((decimal)user.Points > num4) ? ((int)num4) : user.Points;
                    decimal d2   = Math.Round((decimal)num5 / (decimal)masterSettings.ShoppingDeduction, 2);
                    if (d2 > decimal.Zero && num5 > 0)
                    {
                        HtmlInputHidden htmlInputHidden6 = this.hidShoppingDeduction;
                        int             num6             = masterSettings.ShoppingDeduction;
                        htmlInputHidden6.Value               = num6.ToString();
                        this.lblMaxPoints.Text               = num5.ToString();
                        this.lblMaxPointsToPrice.Text        = (num5 / masterSettings.ShoppingDeduction).F2ToString("f2");
                        this.hidCanPointUseWithCoupon.Value  = (masterSettings.CanPointUseWithCoupon ? "true" : "false");
                        this.hidShoppingDeductionRatio.Value = shoppingDeductionRatio.ToString();
                        HtmlInputHidden htmlInputHidden7 = this.hidMyPoints;
                        num6 = user.Points;
                        htmlInputHidden7.Value    = num6.ToString();
                        this.hidCanUsePoint.Value = "true";
                    }
                }
                this.bindPromtionsInfo();
                this.BindLastInvoiceInfo();
                ShoppingCartItemInfo shoppingCartItemInfo = this.cart.LineItems.FirstOrDefault();
                int         productId          = shoppingCartItemInfo.ProductId;
                ProductInfo productBaseDetails = ProductHelper.GetProductBaseDetails(productId);
                IList <ProductInputItemInfo> productInputItemList = ProductHelper.GetProductInputItemList(productId);
                this.hidIsGeneralMuti.Value = productBaseDetails.IsGenerateMore.ToNullString().ToLower();
                string value2 = JsonConvert.SerializeObject(new
                {
                    list = from d in productInputItemList
                           select new
                    {
                        d.Id,
                        d.InputFieldTitle,
                        d.InputFieldType,
                        d.IsRequired,
                        d.InputFileValues
                    }
                });
                this.hidInputItemsJson.Value = value2;
                PageTitle.AddSiteNameTitle("订单确认");
            }
            else if (!this.hasError)
            {
                this.ShowWapMessage("该订单没有任何商品,请重新选择", "default.aspx");
            }
        }
Exemple #17
0
        private void btnPay_Click(object sender, EventArgs e)
        {
            string value  = this.hdorderId.Value;
            int    modeId = 0;

            int.TryParse(this.dropPayType.SelectedValue, out modeId);
            PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(modeId);
            OrderInfo       orderInfo   = TradeHelper.GetOrderInfo(value);
            string          msg         = "";

            if (!TradeHelper.CheckOrderStock(orderInfo, out msg))
            {
                this.ShowMessage(msg, false, "", 1);
            }
            else
            {
                IList <string> list = new List <string>();
                list.Add("hishop.plugins.payment.podrequest");
                list.Add("hishop.plugins.payment.bankrequest");
                if (orderInfo.CountDownBuyId > 0)
                {
                    if (list.Contains(paymentMode.Gateway.ToLower().Trim()))
                    {
                        msg = "限购的订单不支持货到付款和线下支付";
                        this.ShowMessage(msg, false, "", 1);
                        return;
                    }
                    foreach (LineItemInfo value2 in orderInfo.LineItems.Values)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(value2.ProductId, orderInfo.CountDownBuyId, value2.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out msg, orderInfo.StoreId);
                        if (countDownInfo == null)
                        {
                            this.ShowMessage(msg, false, "", 1);
                            return;
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    if (paymentMode == null || (!TradeHelper.GatewayIsCanBackReturn(paymentMode.Gateway) && paymentMode.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1)))
                    {
                        this.ShowMessage("火拼团订单不支付该支付方式进行支付", false, "", 1);
                        return;
                    }
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem.Value.Quantity, out msg);
                        if (fightGroupActivityInfo == null)
                        {
                            this.ShowMessage(msg, false, "", 1);
                            return;
                        }
                    }
                }
                if (orderInfo.GroupBuyId > 0 && list.Contains(paymentMode.Gateway.ToLower().Trim()))
                {
                    msg = "团购的订单不支持货到付款和线下支付";
                    this.ShowMessage(msg, false, "", 1);
                }
                else
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        if (paymentMode.Gateway.ToLower().Trim() == "hishop.plugins.payment.podrequest")
                        {
                            this.ShowMessage("预售订单不支持货到付款", false, "", 1);
                            return;
                        }
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo == null)
                        {
                            this.ShowMessage("预售活动不存在,不能支付", false, "", 1);
                            return;
                        }
                        if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.ShowMessage("您支付晚了,预售活动已经结束", false, "", 1);
                            return;
                        }
                        if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                        {
                            if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                            {
                                this.ShowMessage("尾款支付尚未开始", false, "", 1);
                                return;
                            }
                            DateTime dateTime = productPreSaleInfo.PaymentEndDate;
                            DateTime date     = dateTime.Date;
                            dateTime = DateTime.Now;
                            if (date < dateTime.Date)
                            {
                                this.ShowMessage("尾款支付已结束", false, "", 1);
                                return;
                            }
                        }
                    }
                    if (paymentMode != null)
                    {
                        orderInfo.PaymentTypeId = paymentMode.ModeId;
                        orderInfo.PaymentType   = paymentMode.Name;
                        orderInfo.Gateway       = paymentMode.Gateway;
                        TradeHelper.UpdateOrderPaymentType(orderInfo);
                    }
                    this.Page.Response.Redirect(base.GetRouteUrl("sendPayment", new
                    {
                        orderId = value
                    }));
                }
            }
        }
Exemple #18
0
        protected override void AttachChildControls()
        {
            this.orderId = base.GetParameter("orderId", false);
            if (base.GetParameter("isCallback", false).ToBool())
            {
                HiContext.Current.Context.Response.Clear();
                HiContext.Current.Context.Response.ContentType = "application/json";
                string parameter = base.GetParameter("action", false);
                if (parameter.Equals("ToPay"))
                {
                    string    empty     = string.Empty;
                    OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);
                    if (orderInfo != null || orderInfo.UserId != HiContext.Current.UserId)
                    {
                        if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
                        {
                            HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"当前订单不是等待付款状态\"}");
                            return;
                        }
                        if (orderInfo.CountDownBuyId > 0)
                        {
                            foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                            {
                                CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                                if (countDownInfo == null)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"" + empty + "\"}");
                                    return;
                                }
                            }
                        }
                        if (orderInfo.FightGroupId > 0)
                        {
                            foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                            {
                                FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty);
                                if (fightGroupActivityInfo == null)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"" + empty + "\"}");
                                    return;
                                }
                            }
                        }
                        if (orderInfo.PreSaleId > 0)
                        {
                            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                            if (productPreSaleInfo == null)
                            {
                                HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"预售活动不存在不能支付\"}");
                                return;
                            }
                            if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                            {
                                HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"您支付晚了,预售活动已经结束\"}");
                                return;
                            }
                            if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                            {
                                if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"尾款支付尚未开始\"}");
                                    return;
                                }
                                DateTime dateTime = productPreSaleInfo.PaymentEndDate;
                                DateTime date     = dateTime.Date;
                                dateTime = DateTime.Now;
                                if (date < dateTime.Date)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"尾款支付已结束\"}");
                                    return;
                                }
                            }
                        }
                        int             modeId      = base.GetParameter("paymentModeId", false).ToInt(0);
                        PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                        if (paymentMode == null)
                        {
                            HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"请选择支付方式\"}");
                            return;
                        }
                        orderInfo.PaymentTypeId = paymentMode.ModeId;
                        orderInfo.Gateway       = paymentMode.Gateway;
                        orderInfo.PaymentType   = paymentMode.Name;
                        if (TradeHelper.UpdateOrderPaymentType(orderInfo))
                        {
                            string empty2 = string.Empty;
                            empty2 = ((!(orderInfo.Gateway.ToLower() != "hishop.plugins.payment.advancerequest")) ? ("{\"Status\":1,\"Msg\":\"" + $"/user/pay.aspx?OrderId={this.orderId}" + "\"}") : ((!(orderInfo.Gateway.ToLower() == "hishop.plugins.payment.bankrequest")) ? ("{\"Status\":1,\"Msg\":\"" + base.GetRouteUrl("sendPayment", new
                            {
                                this.orderId
                            }) + "\"}") : ("{\"Status\":1,\"Msg\":\"" + Globals.FullPath(base.GetRouteUrl("bank_pay", new
                            {
                                orderInfo.OrderId
                            })) + "\"}")));
                            HttpContext.Current.Response.Write(empty2);
                            HttpContext.Current.Response.End();
                            return;
                        }
                        goto IL_058f;
                    }
                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"错误的订单信息\"}");
                    HttpContext.Current.Response.End();
                    return;
                }
            }
            goto IL_058f;
IL_058f:
            if (string.IsNullOrEmpty(this.orderId))
            {
                base.GotoResourceNotFound();
            }
            this.litOrderId           = (Literal)this.FindControl("litOrderId");
            this.litOrderPrice        = (FormatedMoneyLabel)this.FindControl("litOrderPrice");
            this.promptMsg            = (HtmlGenericControl)this.FindControl("promptMsg");
            this.onlinePayPanel       = (HtmlGenericControl)this.FindControl("onlinePayPanel");
            this.btnOrderPay          = ButtonManager.Create(this.FindControl("btnOrderPay"));
            this.paymentModeList      = (Common_PaymentModeList)this.FindControl("grd_Common_PaymentModeList");
            this.paymentModeId        = (HtmlInputHidden)this.FindControl("paymentModeId");
            this.AdvanceId            = (HtmlInputHidden)this.FindControl("AdvanceId");
            this.hidOrderid           = (HtmlInputHidden)this.FindControl("hidOrderid");
            this.msgTitle             = (HtmlGenericControl)this.FindControl("msgTitle");
            this.hidIspop             = (HiddenField)this.FindControl("hidIspop");
            this.userLink             = (HtmlAnchor)this.FindControl("userLink");
            this.orderLink            = (HtmlAnchor)this.FindControl("orderLink");
            this.divfinish            = (HtmlGenericControl)this.FindControl("divfinish");
            this.userLink.HRef        = "/User/UserDefault";
            this.divOrderPayInfo      = (HtmlGenericControl)this.FindControl("divOrderPayInfo");
            this.imgPayResult         = (HtmlImage)this.FindControl("imgPayResult");
            this.hidIsPreSale         = (HiddenField)this.FindControl("hidIsPreSale");
            this.litDeposit           = (FormatedMoneyLabel)this.FindControl("litDeposit");
            this.litDeposittxt        = (Literal)this.FindControl("litDeposittxt");
            this.demodiv              = (HtmlGenericControl)this.FindControl("demodiv");
            this.demodiv.Visible      = SettingsManager.GetMasterSettings().IsDemoSite;
            this.hidHasTradePassword  = (HtmlInputHidden)this.FindControl("hidHasTradePassword");
            this.litOfflinePayContent = (Literal)this.FindControl("litOfflinePayContent");
            this.offlinePayPanel      = (HtmlGenericControl)this.FindControl("offlinePayPanel");
            if (!this.Page.IsPostBack)
            {
                this.LoadOrderInfo();
            }
        }
Exemple #19
0
        private void ConfirmPayOrder(HttpContext context)
        {
            SiteSettings currentSiteSetting = base.CurrentSiteSetting;
            string       text = context.Request.Form["orderId"];

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

            if (orderInfo == null)
            {
                throw new HidistroAshxException("异常的参数:订单编号");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                return;
            }
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest");

            if (paymentMode != null)
            {
                orderInfo.Gateway       = paymentMode.Gateway;
                orderInfo.PaymentType   = paymentMode.Name;
                orderInfo.PaymentTypeId = paymentMode.ModeId;
            }
            else
            {
                orderInfo.Gateway       = "hishop.plugins.payment.bankrequest";
                orderInfo.PaymentType   = "线下支付";
                orderInfo.PaymentTypeId = 0;
            }
            orderInfo.IsStoreCollect = true;
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            if (orderInfo.CountDownBuyId > 0)
            {
                string empty = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                {
                    CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                    if (countDownInfo == null)
                    {
                        throw new HidistroAshxException(empty);
                    }
                }
            }
            if (orderInfo.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付");
                }
                num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                num  = groupBuy.MaxCount;
                num3 = orderInfo.GetGroupBuyOerderNumber();
                if (num < num2 + num3)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付");
                }
            }
            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    throw new HidistroAshxException("预售活动不存在");
                }
                if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                {
                    throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款");
                }
            }
            if (OrderHelper.ConfirmPay(orderInfo))
            {
                if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                {
                    PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                }
                if (orderInfo.ParentOrderId == "-1")
                {
                    OrderQuery orderQuery = new OrderQuery();
                    orderQuery.ParentOrderId = orderInfo.OrderId;
                    IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery);
                    foreach (OrderInfo item in listUserOrder)
                    {
                        OrderHelper.OrderConfirmPaySendMessage(item);
                    }
                }
                else
                {
                    OrderHelper.OrderConfirmPaySendMessage(orderInfo);
                }
                base.ReturnResult(context, true, "成功的确认了订单收款", 0, true);
                return;
            }
            throw new HidistroAshxException("确认订单收款失败");
        }
        private void BindOrderInfo()
        {
            if (this.order.BalanceAmount > decimal.Zero)
            {
                this.litBalanceAmount.Text = this.order.BalanceAmount.F2ToString("f2");
            }
            else
            {
                this.liBalanceAmount.Visible = false;
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            DateTime?    nullable;
            DateTime     dateTime;

            if (this.order.PreSaleId > 0)
            {
                this.litDeposit.Text = this.order.Deposit.F2ToString("f2");
                this.litFinal.Text   = this.order.FinalPayment.F2ToString("f2");
                nullable             = this.order.DepositDate;
                if (nullable.HasValue)
                {
                    Literal literal = this.litDepositDate;
                    nullable     = this.order.DepositDate;
                    literal.Text = nullable.ToString();
                }
                DateTime payDate = this.order.PayDate;
                if (this.order.PayDate != DateTime.MinValue)
                {
                    Literal literal2 = this.litFinalDate;
                    dateTime      = this.order.PayDate;
                    literal2.Text = dateTime.ToString();
                }
            }
            if (this.order.ShippingModeId == -2)
            {
                this.divStoreAddress.Visible = true;
                this.divLogists.Visible      = false;
                this.divShipAddress.Visible  = false;
            }
            else
            {
                this.divStoreAddress.Visible = false;
                this.divLogists.Visible      = (this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished);
                this.divShipAddress.Visible  = true;
            }
            if (this.order.OrderStatus == OrderStatus.SellerAlreadySent && this.order.ItemStatus == OrderItemStatus.Nomarl)
            {
                this.ensureRecieved.Visible = true;
            }
            else
            {
                this.ensureRecieved.Visible = false;
            }
            if ((this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(this.order.ExpressCompanyAbb) && !string.IsNullOrEmpty(this.order.ShipOrderNumber))
            {
                this.lookupTrans.Visible = true;
                this.lookupTrans.HRef    = "MyLogistics.aspx?orderId=" + this.order.OrderId;
            }
            else
            {
                this.lookupTrans.Visible = false;
            }
            if (string.IsNullOrEmpty(this.order.TakeCode) || string.IsNullOrEmpty(masterSettings.HiPOSAppId) || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.Closed)
            {
                this.lookupQRCode.Visible = false;
            }
            ProductPreSaleInfo productPreSaleInfo = null;
            int paymentTypeId;

            if (this.order.OrderStatus == OrderStatus.WaitBuyerPay && this.order.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1) && this.order.PaymentTypeId != -3)
            {
                if (this.order.PreSaleId > 0)
                {
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                    nullable           = this.order.DepositDate;
                    if (!nullable.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate > DateTime.Now)
                        {
                            this.btnToPay.Visible = true;
                            AttributeCollection attributes = this.btnToPay.Attributes;
                            paymentTypeId = this.order.PaymentTypeId;
                            attributes.Add("PaymentTypeId", paymentTypeId.ToString());
                            this.btnToPay.Attributes.Add("OrderId", this.orderId);
                            this.btnToPay.Attributes.Add("orderTotal", (this.order.Deposit - this.order.BalanceAmount).F2ToString("f2"));
                        }
                    }
                    else if (!(productPreSaleInfo.PaymentStartDate > DateTime.Now) && !(productPreSaleInfo.PaymentEndDate < DateTime.Now))
                    {
                        this.btnToPay.Visible = true;
                        AttributeCollection attributes2 = this.btnToPay.Attributes;
                        paymentTypeId = this.order.PaymentTypeId;
                        attributes2.Add("PaymentTypeId", paymentTypeId.ToString());
                        this.btnToPay.Attributes.Add("OrderId", this.orderId);
                        this.btnToPay.Attributes.Add("orderTotal", this.order.FinalPayment.F2ToString("f2"));
                    }
                }
                else
                {
                    AttributeCollection attributes3 = this.btnToPay.Attributes;
                    paymentTypeId = this.order.PaymentTypeId;
                    attributes3.Add("PaymentTypeId", paymentTypeId.ToString());
                    this.btnToPay.Visible = true;
                    this.btnToPay.Attributes.Add("OrderId", this.orderId);
                    this.btnToPay.Attributes.Add("orderTotal", this.order.GetTotal(true).F2ToString("f2"));
                    if (HiContext.Current.SiteSettings.OpenMultStore && this.order.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                    {
                        StoresInfo storeById = StoresHelper.GetStoreById(this.order.StoreId);
                        dateTime = DateTime.Now;
                        string str = dateTime.ToString("yyyy-MM-dd");
                        dateTime = storeById.OpenStartDate;
                        nullable = (str + " " + dateTime.ToString("HH:mm")).ToDateTime();
                        DateTime value = nullable.Value;
                        dateTime = DateTime.Now;
                        string str2 = dateTime.ToString("yyyy-MM-dd");
                        dateTime = storeById.OpenEndDate;
                        nullable = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime();
                        DateTime dateTime2 = nullable.Value;
                        if (dateTime2 <= value)
                        {
                            dateTime2 = dateTime2.AddDays(1.0);
                        }
                        if (DateTime.Now < value || DateTime.Now > dateTime2)
                        {
                            this.btnToPay.Attributes.Add("NeedNotInTimeTip", "1");
                        }
                    }
                }
                if (this.order.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.OfflinePay, 1))
                {
                    this.btnToPay.InnerText = "线下支付帮助";
                    this.btnToPay.HRef      = "FinishOrder.aspx?OrderId=" + this.order.OrderId + "&onlyHelp=true";
                }
            }
            if (this.order.ReducedPromotionAmount <= decimal.Zero)
            {
                this.liFullReduction.Visible = false;
            }
            this.litShipTo.Text  = this.order.ShipTo;
            this.litPhone.Text   = this.order.CellPhone;
            this.litAddress.Text = this.order.ShippingRegion + this.order.Address;
            this.litOrderId.Text = this.orderId;
            Literal literal3 = this.litOrderDate;

            dateTime      = this.order.OrderDate;
            literal3.Text = dateTime.ToString();
            this.litTotalPrice.SetWhenIsNotNull(this.order.GetAmount(false).F2ToString("f2"));
            this.litOrderStatus.OrderStatusCode = this.order.OrderStatus;
            this.litOrderStatus.OrderItemStatus = this.order.ItemStatus;
            this.litOrderStatus.ShipmentModelId = this.order.ShippingModeId;
            this.litOrderStatus.IsConfirm       = this.order.IsConfirm;
            this.litOrderStatus.Gateway         = this.order.Gateway;
            this.litOrderStatus.PaymentTypeId   = this.order.PaymentTypeId;
            this.litOrderStatus.PreSaleId       = this.order.PreSaleId;
            this.litOrderStatus.DepositDate     = this.order.DepositDate;
            Literal control = this.litPayTime;
            object  value2;

            if (!(this.order.PayDate != DateTime.MinValue))
            {
                value2 = "";
            }
            else
            {
                dateTime = this.order.PayDate;
                value2   = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            }
            control.SetWhenIsNotNull((string)value2);
            HtmlInputHidden control2 = this.orderStatus;

            paymentTypeId = (int)this.order.OrderStatus;
            control2.SetWhenIsNotNull(paymentTypeId.ToString());
            this.hidOrderId.SetWhenIsNotNull(this.orderId.ToString());
            this.litPaymentMode.SetWhenIsNotNull(this.order.PaymentType);
            this.litShipToDate.SetWhenIsNotNull(this.order.ShipToDate);
            bool flag = false;

            if (this.order.OrderStatus == OrderStatus.BuyerAlreadyPaid || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.WaitReview || this.order.OrderStatus == OrderStatus.History)
            {
                WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= this.order.GetPayTotal() && this.order.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && this.order.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                {
                    flag = true;
                }
            }
            this.hidShowRedEnvelope.SetWhenIsNotNull(flag ? "true" : "false");
            if (this.order.PreSaleId > 0)
            {
                this.litBuildPrice.SetWhenIsNotNull((this.order.Deposit + this.order.FinalPayment).F2ToString("f2"));
            }
            else
            {
                this.litBuildPrice.SetWhenIsNotNull(this.order.GetPayTotal().F2ToString("f2"));
            }
            this.litRemark.SetWhenIsNotNull(this.order.Remark);
            this.litTakeCode.SetWhenIsNotNull((this.order.ShippingModeId == -2) ? this.order.TakeCode : "");
            this.litFreight.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.litFreight2.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.giftFreight.Visible = (this.order.LineItems.Count == 0);
            this.litFullCapacityReduction.SetWhenIsNotNull("-" + this.order.ReducedPromotionAmount.F2ToString("f2"));
            if (this.order.PreSaleId > 0)
            {
                if (productPreSaleInfo == null)
                {
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                }
                nullable = this.order.DepositDate;
                if (!nullable.HasValue)
                {
                    this.hidpresaleStaut.Value = "1";
                    if (this.order.OrderStatus == OrderStatus.Closed)
                    {
                        this.hidpresaleStaut.Value = "6";
                    }
                }
                else if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                {
                    this.hidpresaleStaut.Value = "2";
                }
                else if (productPreSaleInfo.PaymentEndDate < DateTime.Now)
                {
                    if (this.order.PayDate == DateTime.MinValue)
                    {
                        this.hidpresaleStaut.Value = "5";
                    }
                    else
                    {
                        this.hidpresaleStaut.Value = "4";
                    }
                }
                else if (this.order.PayDate == DateTime.MinValue)
                {
                    this.hidpresaleStaut.Value = "3";
                }
                else
                {
                    this.hidpresaleStaut.Value = "4";
                }
            }
        }
        private void ProcessProductSkus(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int       num         = context.Request["sourceId"].ToInt(0);
            int       productId   = int.Parse(context.Request["productId"], NumberStyles.None);
            int       attributeId = int.Parse(context.Request["AttributeId"], NumberStyles.None);
            int       valueId     = int.Parse(context.Request["ValueId"], NumberStyles.None);
            int       num2        = context.Request["StoreId"].ToInt(0);
            DataTable skuItems    = ShoppingProcessor.GetUnUpUnUpsellingSkus(productId, attributeId, valueId);

            if (skuItems == null || skuItems.Rows.Count == 0)
            {
                context.Response.Write("{\"Status\":\"1\"}");
            }
            else
            {
                skuItems.Columns.Add(new DataColumn
                {
                    ColumnName = "SalePrice",
                    DataType   = typeof(decimal)
                });
                bool flag = false;
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("fightgroup".ToLower()) && num > 0)
                {
                    IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(num);
                    if (fightGroupSkus.Count > 0)
                    {
                        flag = true;
                        for (int j = 0; j < skuItems.Rows.Count; j++)
                        {
                            DataRow           row = skuItems.Rows[j];
                            FightGroupSkuInfo fightGroupSkuInfo = (from c in fightGroupSkus
                                                                   where c.SkuId == row["SkuId"].ToString()
                                                                   select c).FirstOrDefault();
                            if (fightGroupSkuInfo == null)
                            {
                                string    skuId  = skuItems.Rows[j]["skuId"].ToString();
                                DataTable theSku = new SkuDao().GetTheSku(skuId);
                                if (theSku != null && theSku.Rows.Count > 0)
                                {
                                    skuItems.Rows[j]["Stock"]     = 0;
                                    skuItems.Rows[j]["SalePrice"] = theSku.Rows[0]["SalePrice"].ToDecimal(0).F2ToString("f2");
                                }
                            }
                            else
                            {
                                int totalCount  = fightGroupSkuInfo.TotalCount;
                                int boughtCount = fightGroupSkuInfo.BoughtCount;
                                int num3        = totalCount - boughtCount;
                                if (num3 > fightGroupSkuInfo.Stock)
                                {
                                    num3 = fightGroupSkuInfo.Stock;
                                }
                                decimal salePrice = fightGroupSkuInfo.SalePrice;
                                skuItems.Rows[j]["Stock"]     = ((num3 >= 0) ? num3 : 0);
                                skuItems.Rows[j]["SalePrice"] = salePrice.F2ToString("f2");
                            }
                        }
                    }
                }
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("countdown"))
                {
                    CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num, num2);
                    if (countDownInfo != null && countDownInfo.CountDownSkuInfo != null && countDownInfo.CountDownSkuInfo.Count > 0)
                    {
                        flag = true;
                        skuItems.Columns.Add(new DataColumn
                        {
                            ColumnName = "OldSalePrice",
                            DataType   = typeof(decimal)
                        });
                        List <CountDownSkuInfo> countDownSkuInfo = countDownInfo.CountDownSkuInfo;
                        int i;
                        for (i = 0; i < skuItems.Rows.Count; i++)
                        {
                            List <CountDownSkuInfo> list = (from s in countDownSkuInfo
                                                            where s.SkuId == skuItems.Rows[i]["SkuId"].ToNullString()
                                                            select s).ToList();
                            if (list == null || list.Count == 0)
                            {
                                string    skuId2  = list[0].SkuId.ToString();
                                DataTable theSku2 = new SkuDao().GetTheSku(skuId2);
                                if (theSku2 != null && theSku2.Rows.Count > 0)
                                {
                                    skuItems.Rows[i]["Stock"]        = 0;
                                    skuItems.Rows[i]["SalePrice"]    = theSku2.Rows[0]["SalePrice"].ToDecimal(0).F2ToString("f2");
                                    skuItems.Rows[i]["OldSalePrice"] = theSku2.Rows[0]["MarketPrice"].ToDecimal(0).F2ToString("f2");
                                }
                            }
                            else
                            {
                                int totalCount2  = list[0].TotalCount;
                                int boughtCount2 = list[0].BoughtCount;
                                int num4         = totalCount2 - boughtCount2;
                                skuItems.Rows[i]["Stock"] = ((num4 >= 0) ? num4 : 0);
                                decimal salePrice2   = list[0].SalePrice;
                                decimal oldSalePrice = list[0].OldSalePrice;
                                skuItems.Rows[i]["SalePrice"]    = salePrice2.F2ToString("f2");
                                skuItems.Rows[i]["OldSalePrice"] = oldSalePrice.F2ToString("f2");
                            }
                        }
                    }
                }
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("groupbuy"))
                {
                    GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num);
                    if (groupBuy != null)
                    {
                        flag = true;
                        skuItems.Columns.Add(new DataColumn
                        {
                            ColumnName = "OldSalePrice",
                            DataType   = typeof(decimal)
                        });
                        Dictionary <string, SKUItem> productSkuSaleInfo = ProductBrowser.GetProductSkuSaleInfo(productId, 0);
                        int soldCount = PromoteHelper.GetSoldCount(groupBuy.GroupBuyId);
                        for (int k = 0; k < skuItems.Rows.Count; k++)
                        {
                            DataRow dataRow = skuItems.Rows[k];
                            if (productSkuSaleInfo.ContainsKey(dataRow["SkuId"].ToNullString()))
                            {
                                SKUItem sKUItem = productSkuSaleInfo[dataRow["SkuId"].ToNullString()];
                                int     num5    = skuItems.Rows[k]["Stock"].ToInt(0);
                                int     num6    = groupBuy.MaxCount - soldCount;
                                if (num5 < num6)
                                {
                                    skuItems.Rows[k]["Stock"] = num5;
                                }
                                else
                                {
                                    skuItems.Rows[k]["Stock"] = num6;
                                }
                                skuItems.Rows[k]["SalePrice"]    = groupBuy.Price.F2ToString("f2");
                                skuItems.Rows[k]["OldSalePrice"] = sKUItem.SalePrice.F2ToString("f2");
                            }
                        }
                    }
                }
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("presaleproductdetails") && num > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(num);
                    if (productPreSaleInfo != null)
                    {
                        flag = true;
                        Dictionary <string, SKUItem> preSaleProductSkuSaleInfo = ProductBrowser.GetPreSaleProductSkuSaleInfo(productId);
                        foreach (DataRow row2 in skuItems.Rows)
                        {
                            if (preSaleProductSkuSaleInfo.ContainsKey(row2["SkuId"].ToString()))
                            {
                                SKUItem sKUItem2 = preSaleProductSkuSaleInfo[row2["SkuId"].ToString()];
                                row2["SalePrice"] = sKUItem2.SalePrice;
                                row2["Stock"]     = sKUItem2.Stock;
                            }
                        }
                    }
                }
                if (!flag)
                {
                    Dictionary <string, SKUItem> productSkuSaleInfo2 = ProductBrowser.GetProductSkuSaleInfo(productId, num2);
                    string text = "";
                    if (num2 == 0)
                    {
                        text = PromoteHelper.GetPhonePriceByProductId(productId);
                    }
                    foreach (DataRow row3 in skuItems.Rows)
                    {
                        if (productSkuSaleInfo2.ContainsKey(row3["SkuId"].ToString()))
                        {
                            SKUItem sKUItem3 = productSkuSaleInfo2[row3["SkuId"].ToString()];
                            if (!string.IsNullOrEmpty(text))
                            {
                                string  s2   = text.Split(',')[0];
                                decimal num7 = (sKUItem3.SalePrice - decimal.Parse(s2) > decimal.Zero) ? (sKUItem3.SalePrice - decimal.Parse(s2)) : decimal.Zero;
                                row3["SalePrice"] = num7.F2ToString("f2");
                            }
                            else
                            {
                                row3["SalePrice"] = sKUItem3.SalePrice;
                            }
                            row3["Stock"] = sKUItem3.Stock;
                        }
                        else
                        {
                            row3["Stock"]     = "0";
                            row3["SalePrice"] = "0.00";
                        }
                    }
                }
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("{");
                stringBuilder.Append("\"Status\":\"OK\",");
                stringBuilder.Append("\"SkuItems\":[");
                foreach (DataRow row4 in skuItems.Rows)
                {
                    stringBuilder.Append("{");
                    if (skuItems.Columns.Contains("SkuId"))
                    {
                        stringBuilder.AppendFormat("\"SkuId\":\"{0}\",", row4["SkuId"].ToString());
                    }
                    if (skuItems.Columns.Contains("SalePrice"))
                    {
                        stringBuilder.AppendFormat("\"SalePrice\":\"{0}\",", row4["SalePrice"].ToDecimal(0).F2ToString("f2"));
                    }
                    if (skuItems.Columns.Contains("OldSalePrice"))
                    {
                        stringBuilder.AppendFormat("\"OldSalePrice\":\"{0}\",", row4["OldSalePrice"].ToDecimal(0).F2ToString("f2"));
                    }
                    if (skuItems.Columns.Contains("Stock"))
                    {
                        stringBuilder.AppendFormat("\"Stock\":\"{0}\",", row4["Stock"].ToString());
                    }
                    stringBuilder.AppendFormat("\"AttributeId\":\"{0}\",", row4["AttributeId"].ToString());
                    stringBuilder.AppendFormat("\"ValueId\":\"{0}\"", row4["ValueId"].ToString());
                    stringBuilder.Append("},");
                }
                stringBuilder.Remove(stringBuilder.Length - 1, 1);
                stringBuilder.Append("]");
                stringBuilder.Append("}");
                context.Response.Write(stringBuilder.ToString());
            }
        }
Exemple #22
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null || orderInfo.UserId != HiContext.Current.UserId)
            {
                base.GotoResourceNotFound("");
            }
            this.litOrderId          = (Literal)this.FindControl("litOrderId");
            this.litOrderTotal       = (Literal)this.FindControl("litOrderTotal");
            this.litPaymentType      = (HtmlInputHidden)this.FindControl("litPaymentType");
            this.litPaymentName      = (Literal)this.FindControl("litPaymentName");
            this.litPaymentName.Text = orderInfo.PaymentType;
            this.litErrorMsg         = (Literal)this.FindControl("litErrorMsg");
            this.litPaymentType.SetWhenIsNotNull(orderInfo.PaymentTypeId.ToString());
            this.litOrderId.SetWhenIsNotNull(this.orderId);
            this.litOrderTotal.SetWhenIsNotNull(orderInfo.GetTotal(false).F2ToString("f2"));
            this.divhelper = (HtmlGenericControl)this.FindControl("helper");
            this.btnToPay  = (HtmlAnchor)this.FindControl("btnToPay");
            Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;

            foreach (LineItemInfo value in lineItems.Values)
            {
                int          productId         = value.ProductId;
                SiteSettings masterSettings    = SettingsManager.GetMasterSettings();
                ProductInfo  productSimpleInfo = ProductBrowser.GetProductSimpleInfo(productId);
                if (productSimpleInfo == null || productSimpleInfo.SaleStatus == ProductSaleStatus.Delete)
                {
                    this.litErrorMsg.Text = "订单内商品已经被管理员删除";
                    this.btnToPay.Visible = false;
                }
                else if (productSimpleInfo.SaleStatus == ProductSaleStatus.OnStock)
                {
                    this.litErrorMsg.Text = "订单内商品已入库";
                    this.btnToPay.Visible = false;
                }
                else
                {
                    int num = 0;
                    if (productSimpleInfo.Skus.ContainsKey(value.SkuId))
                    {
                        SKUItem sKUItem = productSimpleInfo.Skus[value.SkuId];
                        num = sKUItem.MaxStock;
                        continue;
                    }
                    this.litErrorMsg.Text = "订单中有商品规格不存在,不能进行支付";
                    this.btnToPay.Visible = false;
                }
                return;
            }
            string str = "";

            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    this.litErrorMsg.Text = "预售活动不存在不能支付";
                    return;
                }
                if (!orderInfo.DepositDate.HasValue)
                {
                    if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                    {
                        this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                        return;
                    }
                    if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                    {
                        this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                        return;
                    }
                }
                if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                    {
                        this.litErrorMsg.Text = "尾款支付尚未开始";
                        return;
                    }
                    DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                    if (t <= DateTime.Now)
                    {
                        this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                        return;
                    }
                }
            }
            else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
            {
                this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                return;
            }
            if (orderInfo.Gateway != "hishop.plugins.payment.bankrequest")
            {
                this.divhelper.Visible = false;
            }
            else
            {
                this.divhelper.Visible = true;
                this.litHelperText     = (Literal)this.FindControl("litHelperText");
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(ShoppingProcessor.GetPaymentGateway(EnumPaymentType.OfflinePay));
                if (paymentMode != null)
                {
                    this.litHelperText.SetWhenIsNotNull(paymentMode.Description);
                }
            }
            this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay");
            if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.btnToPay.Visible = false;
            }
            if (this.btnToPay != null)
            {
                this.btnToPay.HRef = "FinishOrder?orderId=" + this.orderId + "&action=topay";
            }
            else
            {
                this.GotoPay();
            }
            if (this.btnToPay != null && (orderInfo.Gateway == "hishop.plugins.payment.podrequest" || orderInfo.Gateway == "hishop.plugins.payment.bankrequest"))
            {
                this.btnToPay.Visible = false;
            }
            PageTitle.AddSiteNameTitle("下单成功");
            if (!this.Page.IsPostBack)
            {
                string text = HttpContext.Current.Request.QueryString["action"];
                if (!string.IsNullOrEmpty(text) && text == "topay")
                {
                    this.GotoPay();
                }
            }
        }
Exemple #23
0
        private void btnAddPreSale_Click(object sender, EventArgs e)
        {
            this.btnAddPreSale.Enabled = false;
            int     num  = 0;
            int     num2 = 0;
            int     num3 = 0;
            decimal num4 = default(decimal);
            int     num5 = 0;

            int.TryParse(this.hidPreSaleId.Value, out num);
            int.TryParse(this.hidProductId.Value, out num2);
            if (num2 <= 0)
            {
                this.ShowMsg("请选择预售商品!", false);
                this.btnAddPreSale.Enabled = true;
            }
            else if (!this.PreSaleEndDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择预售结束时间!", false);
                this.btnAddPreSale.Enabled = true;
            }
            else if (!this.PaymentStartDate.SelectedDate.HasValue || !this.PaymentEndDate.SelectedDate.HasValue)
            {
                this.ShowMsg("请选择尾款支付时间!", false);
                this.btnAddPreSale.Enabled = true;
            }
            else if (this.PreSaleEndDate.SelectedDate.Value < DateTime.Now)
            {
                this.ShowMsg("预售结束时间不能早于当前时间!", false);
                this.btnAddPreSale.Enabled = true;
            }
            else
            {
                DateTime dateTime = this.PaymentStartDate.SelectedDate.Value;
                if (dateTime.CompareTo(this.PaymentEndDate.SelectedDate.Value) > 0)
                {
                    this.ShowMsg("尾款支付开始时间不能晚于尾款支付结束时间!", false);
                    this.btnAddPreSale.Enabled = true;
                }
                else
                {
                    dateTime = this.PaymentEndDate.SelectedDate.Value;
                    if (dateTime.CompareTo(this.PreSaleEndDate.SelectedDate.Value) < 0)
                    {
                        this.ShowMsg("尾款支付结束时间不能早于预售结束时间!", false);
                        this.btnAddPreSale.Enabled = true;
                    }
                    else
                    {
                        dateTime = this.PaymentStartDate.SelectedDate.Value;
                        DateTime now = DateTime.Now;
                        if (dateTime.CompareTo(DateTime.Parse(now.ToString("yyyy-MM-dd"))) < 0)
                        {
                            this.ShowMsg("尾款支付开始时间不能早于当前时间!", false);
                            this.btnAddPreSale.Enabled = true;
                        }
                        else
                        {
                            dateTime = this.PaymentEndDate.SelectedDate.Value;
                            now      = DateTime.Now;
                            if (dateTime.CompareTo(DateTime.Parse(now.ToString("yyyy-MM-dd"))) < 0)
                            {
                                this.ShowMsg("尾款支付结束时间不能早于当前时间!", false);
                                this.btnAddPreSale.Enabled = true;
                            }
                            else
                            {
                                if (this.radDepositPercent.Checked)
                                {
                                    int.TryParse(this.txtDepositPercent.Text, out num3);
                                    if (num3 <= 0 || num3 > 100)
                                    {
                                        this.ShowMsg("定金百分比只能输入数字,限制在1-100之间!", false);
                                        this.btnAddPreSale.Enabled = true;
                                        return;
                                    }
                                }
                                else
                                {
                                    decimal.TryParse(this.txtDeposit.Text.Trim(), out num4);
                                    if (num4 <= decimal.Zero)
                                    {
                                        this.ShowMsg("定金固定金额只能输入数字,限制2位小数!", false);
                                        this.btnAddPreSale.Enabled = true;
                                        return;
                                    }
                                    decimal d = string.IsNullOrEmpty(this.hidSalePrice.Value) ? decimal.Zero : decimal.Parse(this.hidSalePrice.Value);
                                    if (num4 > d)
                                    {
                                        this.ShowMsg("定金不能大于商品售价!", false);
                                        this.btnAddPreSale.Enabled = true;
                                        return;
                                    }
                                    if (num4 > 100000000m)
                                    {
                                        this.ShowMsg("您输入的固定金额过大!", false);
                                        this.btnAddPreSale.Enabled = true;
                                        return;
                                    }
                                }
                                if (this.radDeliveryDays.Checked)
                                {
                                    int.TryParse(this.txtDeliveryDays.Text, out num5);
                                    if (num5 <= 0 || num5 > 1000)
                                    {
                                        this.ShowMsg("天数只能输入整数,限制在1-1000之间!", false);
                                        this.btnAddPreSale.Enabled = true;
                                        return;
                                    }
                                }
                                else
                                {
                                    if (!this.DeliveryDate.SelectedDate.HasValue)
                                    {
                                        this.ShowMsg("请选择发货时间!", false);
                                        this.btnAddPreSale.Enabled = true;
                                        return;
                                    }
                                    dateTime = this.DeliveryDate.SelectedDate.Value;
                                    now      = DateTime.Now;
                                    if (dateTime.CompareTo(DateTime.Parse(now.ToString("yyyy-MM-dd"))) < 0)
                                    {
                                        this.ShowMsg("发货时间不能早于当前时间!", false);
                                        this.btnAddPreSale.Enabled = true;
                                        return;
                                    }
                                }
                                ProductPreSaleInfo productPreSaleInfo = new ProductPreSaleInfo();
                                productPreSaleInfo.PreSaleId = num;
                                productPreSaleInfo.ProductId = num2;
                                if (this.radDepositPercent.Checked)
                                {
                                    productPreSaleInfo.DepositPercent = num3;
                                    productPreSaleInfo.Deposit        = decimal.Zero;
                                }
                                else
                                {
                                    productPreSaleInfo.Deposit        = num4;
                                    productPreSaleInfo.DepositPercent = 0;
                                }
                                productPreSaleInfo.PreSaleEndDate   = this.PreSaleEndDate.SelectedDate.Value;
                                productPreSaleInfo.PaymentStartDate = this.PaymentStartDate.SelectedDate.Value;
                                ProductPreSaleInfo productPreSaleInfo2 = productPreSaleInfo;
                                dateTime = this.PaymentEndDate.SelectedDate.Value;
                                dateTime = dateTime.AddDays(1.0);
                                productPreSaleInfo2.PaymentEndDate = dateTime.AddSeconds(-1.0);
                                if (this.radDeliveryDays.Checked)
                                {
                                    productPreSaleInfo.DeliveryDays = num5;
                                    productPreSaleInfo.DeliveryDate = null;
                                }
                                else
                                {
                                    productPreSaleInfo.DeliveryDays = 0;
                                    productPreSaleInfo.DeliveryDate = this.DeliveryDate.SelectedDate.Value;
                                }
                                if (ProductPreSaleHelper.UpdatePreSale(productPreSaleInfo))
                                {
                                    this.ShowMsg("编辑预售活动成功!", true, "ProductPreSale.aspx");
                                }
                                else
                                {
                                    this.ShowMsg("编辑失败!", false);
                                    this.btnAddPreSale.Enabled = true;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #24
0
        private void BindOrderInfo()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (this.order.BalanceAmount > decimal.Zero)
            {
                this.litBalanceAmount.Text = this.order.BalanceAmount.F2ToString("f2");
            }
            else
            {
                this.liBalanceAmount.Visible = false;
            }
            DateTime?nullable;
            DateTime dateTime;

            if (this.order.PreSaleId > 0)
            {
                this.litDeposit.Text = this.order.Deposit.F2ToString("f2");
                this.litFinal.Text   = this.order.FinalPayment.F2ToString("f2");
                nullable             = this.order.DepositDate;
                if (nullable.HasValue)
                {
                    Literal literal = this.litDepositDate;
                    nullable     = this.order.DepositDate;
                    literal.Text = nullable.ToString();
                }
                DateTime payDate = this.order.PayDate;
                if (this.order.PayDate != DateTime.MinValue)
                {
                    Literal literal2 = this.litFinalDate;
                    dateTime      = this.order.PayDate;
                    literal2.Text = dateTime.ToString();
                }
            }
            if (this.order.OrderStatus == OrderStatus.SellerAlreadySent && this.order.ItemStatus == OrderItemStatus.Nomarl)
            {
                this.ensureRecieved.Visible = true;
            }
            else
            {
                this.ensureRecieved.Visible = false;
            }
            if (this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished)
            {
                this.divOrderBtn.Visible = false;
            }
            if (string.IsNullOrEmpty(this.order.TakeCode) || string.IsNullOrEmpty(masterSettings.HiPOSAppId) || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.Closed)
            {
                this.lookupQRCode.Visible = false;
            }
            ProductPreSaleInfo productPreSaleInfo = null;
            int paymentTypeId;

            if (this.order.OrderStatus == OrderStatus.WaitBuyerPay && this.order.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1) && this.order.PaymentTypeId != -3)
            {
                if (this.order.PreSaleId > 0)
                {
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                    nullable           = this.order.DepositDate;
                    if (!nullable.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate > DateTime.Now)
                        {
                            this.btnToPay.Visible = true;
                            AttributeCollection attributes = this.btnToPay.Attributes;
                            paymentTypeId = this.order.PaymentTypeId;
                            attributes.Add("PaymentTypeId", paymentTypeId.ToString());
                            this.btnToPay.Attributes.Add("OrderId", this.orderId);
                            this.btnToPay.Attributes.Add("orderTotal", (this.order.Deposit - this.order.BalanceAmount).F2ToString("f2"));
                        }
                    }
                    else if (!(productPreSaleInfo.PaymentStartDate > DateTime.Now) && !(productPreSaleInfo.PaymentEndDate < DateTime.Now))
                    {
                        this.btnToPay.Visible = true;
                        AttributeCollection attributes2 = this.btnToPay.Attributes;
                        paymentTypeId = this.order.PaymentTypeId;
                        attributes2.Add("PaymentTypeId", paymentTypeId.ToString());
                        this.btnToPay.Attributes.Add("OrderId", this.orderId);
                        this.btnToPay.Attributes.Add("orderTotal", this.order.FinalPayment.F2ToString("f2"));
                    }
                }
                else
                {
                    AttributeCollection attributes3 = this.btnToPay.Attributes;
                    paymentTypeId = this.order.PaymentTypeId;
                    attributes3.Add("PaymentTypeId", paymentTypeId.ToString());
                    this.btnToPay.Visible = true;
                    this.btnToPay.Attributes.Add("OrderId", this.orderId);
                    this.btnToPay.Attributes.Add("orderTotal", this.order.GetTotal(true).F2ToString("f2"));
                    if (HiContext.Current.SiteSettings.OpenMultStore && this.order.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                    {
                        StoresInfo storeById = StoresHelper.GetStoreById(this.order.StoreId);
                        dateTime = DateTime.Now;
                        string str = dateTime.ToString("yyyy-MM-dd");
                        dateTime = storeById.OpenStartDate;
                        nullable = (str + " " + dateTime.ToString("HH:mm")).ToDateTime();
                        DateTime value = nullable.Value;
                        dateTime = DateTime.Now;
                        string str2 = dateTime.ToString("yyyy-MM-dd");
                        dateTime = storeById.OpenEndDate;
                        nullable = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime();
                        DateTime dateTime2 = nullable.Value;
                        if (dateTime2 <= value)
                        {
                            dateTime2 = dateTime2.AddDays(1.0);
                        }
                        if (DateTime.Now < value || DateTime.Now > dateTime2)
                        {
                            this.btnToPay.Attributes.Add("NeedNotInTimeTip", "1");
                        }
                    }
                }
                if (this.order.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.OfflinePay, 1))
                {
                    this.btnToPay.InnerText = "线下支付帮助";
                    this.btnToPay.HRef      = "FinishOrder.aspx?OrderId=" + this.order.OrderId + "&onlyHelp=true";
                }
            }
            if (this.order.ReducedPromotionAmount <= decimal.Zero)
            {
                this.liFullReduction.Visible = false;
            }
            LineItemInfo value2 = this.order.LineItems.FirstOrDefault().Value;
            string       text   = "长期有效";
            int          num;

            if (!value2.IsValid)
            {
                nullable = value2.ValidStartDate;
                if (nullable.HasValue)
                {
                    nullable = value2.ValidEndDate;
                    num      = (nullable.HasValue ? 1 : 0);
                    goto IL_06a5;
                }
            }
            num = 0;
            goto IL_06a5;
IL_06a5:
            if (num != 0)
            {
                nullable = value2.ValidStartDate;
                dateTime = nullable.Value;
                string arg = dateTime.ToString("yyyy-MM-dd");
                nullable = value2.ValidEndDate;
                dateTime = nullable.Value;
                text     = string.Format("有效期&nbsp;&nbsp;{0} ~ {1}", arg, dateTime.ToString("yyyy-MM-dd"));
            }
            this.lit_ValidDate.Text = text;
            IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(this.order.OrderId);
            ServiceOrderStatus serviceOrderStatus = this.GetOrderStatus(this.order, orderVerificationItems);

            this.litOrderStatus.Text = ((Enum)(object)serviceOrderStatus).ToDescription();
            this.CreateVerificationCodeQRCode(orderVerificationItems);
            this.rptVerCode.DataSource     = orderVerificationItems;
            this.rptVerCode.ItemDataBound += this.rptVerCode_ItemDataBound;
            this.rptVerCode.DataBind();
            this.litOrderId.Text = this.orderId;
            Literal literal3 = this.litOrderDate;

            dateTime      = this.order.OrderDate;
            literal3.Text = dateTime.ToString();
            this.litTotalPrice.SetWhenIsNotNull(this.order.GetAmount(false).F2ToString("f2"));
            Literal control = this.litPayTime;
            object  value3;

            if (!(this.order.PayDate != DateTime.MinValue))
            {
                value3 = "";
            }
            else
            {
                dateTime = this.order.PayDate;
                value3   = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            }
            control.SetWhenIsNotNull((string)value3);
            HtmlInputHidden control2 = this.orderStatus;

            paymentTypeId = (int)this.order.OrderStatus;
            control2.SetWhenIsNotNull(paymentTypeId.ToString());
            this.hidOrderId.SetWhenIsNotNull(this.orderId.ToString());
            this.litPaymentMode.SetWhenIsNotNull(this.order.PaymentType);
            this.litShipToDate.SetWhenIsNotNull(this.order.ShipToDate);
            if (this.order.PreSaleId > 0)
            {
                this.litBuildPrice.SetWhenIsNotNull((this.order.Deposit + this.order.FinalPayment).F2ToString("f2"));
            }
            else
            {
                this.litBuildPrice.SetWhenIsNotNull(this.order.GetPayTotal().F2ToString("f2"));
            }
            this.litRemark.SetWhenIsNotNull(this.order.Remark);
            this.litTakeCode.SetWhenIsNotNull((this.order.ShippingModeId == -2) ? this.order.TakeCode : "");
            this.litFreight.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.litFreight2.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.litFullCapacityReduction.SetWhenIsNotNull("-" + this.order.ReducedPromotionAmount.F2ToString("f2"));
            if (this.order.PreSaleId > 0)
            {
                if (productPreSaleInfo == null)
                {
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                }
                nullable = this.order.DepositDate;
                if (!nullable.HasValue)
                {
                    this.hidpresaleStaut.Value = "1";
                    if (this.order.OrderStatus == OrderStatus.Closed)
                    {
                        this.hidpresaleStaut.Value = "6";
                    }
                }
                else if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                {
                    this.hidpresaleStaut.Value = "2";
                }
                else if (productPreSaleInfo.PaymentEndDate < DateTime.Now)
                {
                    if (this.order.PayDate == DateTime.MinValue)
                    {
                        this.hidpresaleStaut.Value = "5";
                    }
                    else
                    {
                        this.hidpresaleStaut.Value = "4";
                    }
                }
                else if (this.order.PayDate == DateTime.MinValue)
                {
                    this.hidpresaleStaut.Value = "3";
                }
                else
                {
                    this.hidpresaleStaut.Value = "4";
                }
            }
        }
Exemple #25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.btnAddPreSale.Click += this.btnAddPreSale_Click;
     this.PreSaleEndDate.CalendarParameter["format"]  = "yyyy-mm-dd hh:ii:00";
     this.PreSaleEndDate.CalendarParameter["minView"] = "0";
     if (!base.IsPostBack)
     {
         if (!int.TryParse(this.Page.Request.QueryString["preSaleId"], out this.preSaleId))
         {
             base.GotoResourceNotFound();
         }
         else
         {
             if (ProductPreSaleHelper.IsPreSaleHasOrder(this.preSaleId))
             {
                 this.ShowMsg("该预售已产生订单,不能修改!", false, "ProductPreSale.aspx");
             }
             ProductPreSaleInfo preSaleInfoWithNameAndPrice = ProductPreSaleHelper.GetPreSaleInfoWithNameAndPrice(this.preSaleId);
             if (preSaleInfoWithNameAndPrice != null)
             {
                 HiddenField hiddenField = this.hidPreSaleId;
                 int         num         = preSaleInfoWithNameAndPrice.PreSaleId;
                 hiddenField.Value = num.ToString();
                 HiddenField hiddenField2 = this.hidProductId;
                 num = preSaleInfoWithNameAndPrice.ProductId;
                 hiddenField2.Value        = num.ToString();
                 this.hidProductName.Value = preSaleInfoWithNameAndPrice.ProductName;
                 this.hidSalePrice.Value   = preSaleInfoWithNameAndPrice.SalePrice.F2ToString("f2");
                 if (preSaleInfoWithNameAndPrice.DepositPercent > 0)
                 {
                     this.radDepositPercent.Checked = true;
                     TextBox textBox = this.txtDepositPercent;
                     num          = preSaleInfoWithNameAndPrice.DepositPercent;
                     textBox.Text = num.ToString();
                 }
                 else if (preSaleInfoWithNameAndPrice.Deposit > decimal.Zero)
                 {
                     this.radDeposit.Checked = true;
                     this.txtDeposit.Text    = preSaleInfoWithNameAndPrice.Deposit.ToString();
                 }
                 this.PreSaleEndDate.SelectedDate   = preSaleInfoWithNameAndPrice.PreSaleEndDate;
                 this.PaymentStartDate.SelectedDate = preSaleInfoWithNameAndPrice.PaymentStartDate;
                 this.PaymentEndDate.SelectedDate   = preSaleInfoWithNameAndPrice.PaymentEndDate;
                 if (preSaleInfoWithNameAndPrice.DeliveryDays > 0)
                 {
                     this.radDeliveryDays.Checked = true;
                     TextBox textBox2 = this.txtDeliveryDays;
                     num           = preSaleInfoWithNameAndPrice.DeliveryDays;
                     textBox2.Text = num.ToString();
                 }
                 else if (preSaleInfoWithNameAndPrice.DeliveryDate.HasValue)
                 {
                     this.radDeliveryDate.Checked   = true;
                     this.DeliveryDate.SelectedDate = preSaleInfoWithNameAndPrice.DeliveryDate;
                 }
             }
             else
             {
                 base.GotoResourceNotFound();
             }
         }
     }
 }
        protected override void AttachChildControls()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (!int.TryParse(this.Page.Request.QueryString["PreSaleId"], out this.presaleId))
            {
                this.ShowWapMessage("错误的活动ID", "Default.aspx");
                return;
            }
            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.presaleId);

            if (productPreSaleInfo == null)
            {
                this.ShowWapMessage("错误的活动ID", "Default.aspx");
                return;
            }
            if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
            {
                this.Page.Response.Redirect("ProductDetails.aspx?ProductId = " + productPreSaleInfo.ProductId);
                return;
            }
            this.productId               = productPreSaleInfo.ProductId;
            this.hidSupplier             = (HtmlInputHidden)this.FindControl("hidSupplier");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.rptCouponList           = (WapTemplatedRepeater)this.FindControl("rptCouponList");
            this.rp_guest                = (WapTemplatedRepeater)this.FindControl("rp_guest");
            this.rp_com                  = (WapTemplatedRepeater)this.FindControl("rp_com");
            this.litProdcutName          = (Literal)this.FindControl("litProdcutName");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.ltlcombinamaininfo      = (Literal)this.FindControl("ltlcombinamaininfo");
            this.skuSubmitOrder          = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.expandAttr              = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount            = (Literal)this.FindControl("litSoldCount");
            this.litConsultationsCount   = (Literal)this.FindControl("litConsultationsCount");
            this.litReviewsCount         = (Literal)this.FindControl("litReviewsCount");
            this.litHasCollected         = (HtmlInputHidden)this.FindControl("litHasCollected");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.ltlOrderPromotion2      = (Literal)this.FindControl("ltlOrderPromotion2");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.ltlProductSendGifts2    = (Literal)this.FindControl("ltlProductSendGifts2");
            this.liOrderPromotions       = (HtmlGenericControl)this.FindControl("liOrderPromotions");
            this.liOrderPromotions2      = (HtmlGenericControl)this.FindControl("liOrderPromotions2");
            this.liProductSendGifts      = (HtmlGenericControl)this.FindControl("liProductSendGifts");
            this.liProductSendGifts2     = (HtmlGenericControl)this.FindControl("liProductSendGifts2");
            this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2");
            this.liOrderPromotions_free  = (HtmlGenericControl)this.FindControl("liOrderPromotions_free");
            this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.divshiptoregion         = (HtmlGenericControl)this.FindControl("divshiptoregion");
            this.divwaplocateaddress     = (HtmlGenericControl)this.FindControl("divwaplocateaddress");
            this.productFreight          = (ProductFreightLiteral)this.FindControl("productFreight");
            this.promote                 = (ProductPromote)this.FindControl("ProductPromote");
            this.hdAppId                 = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTitle                 = (HtmlInputHidden)this.FindControl("hdTitle");
            this.hdDesc                  = (HtmlInputHidden)this.FindControl("hdDesc");
            this.hdImgUrl                = (HtmlInputHidden)this.FindControl("hdImgUrl");
            this.hdLink                  = (HtmlInputHidden)this.FindControl("hdLink");
            this.hidCombinaid            = (HtmlInputHidden)this.FindControl("hidCombinaid");
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.ulConsultations         = (HtmlGenericControl)this.FindControl("ulConsultations");
            this.divShortDescription     = (HtmlGenericControl)this.FindControl("divShortDescription");
            this.hidRegionId             = (HtmlInputHidden)this.FindControl("hidRegionId");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidCouponCount          = (HtmlInputHidden)this.FindControl("hidCouponCount");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divPodrequest           = (HtmlGenericControl)this.FindControl("divPodrequest");
            this.divGuest                = (HtmlGenericControl)this.FindControl("divGuest");
            this.divcombina              = (HtmlGenericControl)this.FindControl("divcombina");
            this.hidUnOnSale             = (HtmlInputHidden)this.FindControl("hidUnOnSale");
            this.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litpresaleprice         = (Literal)this.FindControl("litpresaleprice");
            this.litsaleprice            = (Literal)this.FindControl("litsaleprice");
            this.litRetainage            = (Literal)this.FindControl("litRetainage");
            this.litDeliverGood          = (Literal)this.FindControl("litDeliverGood");
            this.hidEndDate              = (HtmlInputHidden)this.FindControl("hidEndDate");
            this.hidNowDate              = (HtmlInputHidden)this.FindControl("hidNowDate");
            this.hdAppId.Value           = masterSettings.WeixinAppId;
            HtmlInputHidden htmlInputHidden = this.hidRegionId;
            int             num             = HiContext.Current.DeliveryScopRegionId;

            htmlInputHidden.Value = num.ToString();
            this.hidden_skuItem   = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidCartQuantity  = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.lblStock         = (StockLabel)this.FindControl("lblStock");
            this.litUnit          = (Literal)this.FindControl("litUnit");
            ProductBrowseInfo productPreSaleBrowseInfo = ProductBrowser.GetProductPreSaleBrowseInfo(this.productId, true);

            if (productPreSaleBrowseInfo.Product == null || productPreSaleBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("ProductDelete.aspx");
                return;
            }
            if (productPreSaleBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.hidUnOnSale.Value = "1";
            }
            this.litpresaleprice.Text = ((productPreSaleInfo.DepositPercent == 0) ? productPreSaleInfo.Deposit.F2ToString("f2") : ((decimal)productPreSaleInfo.DepositPercent * productPreSaleBrowseInfo.Product.MinSalePrice / 100m).F2ToString("f2"));
            if (productPreSaleBrowseInfo.Product.MinSalePrice < productPreSaleBrowseInfo.Product.MaxSalePrice)
            {
                this.litsaleprice.Text = "¥" + productPreSaleBrowseInfo.Product.MinSalePrice.F2ToString("f2") + "~ ¥" + productPreSaleBrowseInfo.Product.MaxSalePrice.F2ToString("f2");
            }
            else
            {
                this.litsaleprice.Text = "¥" + productPreSaleBrowseInfo.Product.MinSalePrice.F2ToString("f2");
            }
            Literal  literal  = this.litRetainage;
            DateTime dateTime = productPreSaleInfo.PaymentStartDate;
            string   str      = dateTime.ToString("yyyy/MM/dd");

            dateTime     = productPreSaleInfo.PaymentEndDate;
            literal.Text = str + "~" + dateTime.ToString("yyyy/MM/dd");
            Literal literal2 = this.litDeliverGood;
            object  text;

            if (!productPreSaleInfo.DeliveryDate.HasValue)
            {
                text = $"尾款支付后{productPreSaleInfo.DeliveryDays}天内发货";
            }
            else
            {
                dateTime = productPreSaleInfo.DeliveryDate.Value;
                text     = dateTime.ToString("yyyy年MM月dd日") + "发货";
            }
            literal2.Text = (string)text;
            HtmlInputHidden htmlInputHidden2 = this.hidNowDate;

            dateTime = DateTime.Now;
            htmlInputHidden2.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            HtmlInputHidden htmlInputHidden3 = this.hidEndDate;

            dateTime = productPreSaleInfo.PreSaleEndDate;
            htmlInputHidden3.Value                 = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            this.skuSubmitOrder.ProductInfo        = productPreSaleBrowseInfo.Product;
            this.skuSubmitOrder.OrderBusiness      = 4;
            this.skuSubmitOrder.PreSaleId          = this.presaleId;
            this.skuSubmitOrder.productPreSaleInfo = productPreSaleInfo;
            this.lbUserProductRefer.product        = productPreSaleBrowseInfo.Product;
            this.productFreight.ShippingTemplateId = productPreSaleBrowseInfo.Product.ShippingTemplateId;
            this.productFreight.Volume             = productPreSaleBrowseInfo.Product.Weight;
            this.productFreight.Weight             = productPreSaleBrowseInfo.Product.Weight;
            this.hdTitle.Value = Globals.StripAllTags(string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.Title) ? productPreSaleBrowseInfo.Product.ProductName : productPreSaleBrowseInfo.Product.Title);
            this.hdDesc.Value  = Globals.StripAllTags(string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : productPreSaleBrowseInfo.Product.ShortDescription);
            string local = string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl1) ? SettingsManager.GetMasterSettings().DefaultProductImage : productPreSaleBrowseInfo.Product.ImageUrl1;

            this.hdImgUrl.Value = Globals.FullPath(local);
            this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
            IEnumerable enumerable = from item in productPreSaleBrowseInfo.Product.Skus
                                     select item.Value;

            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(this.productId);
            }
            IEnumerable value = from item in productPreSaleBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productPreSaleBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productPreSaleBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            if (this.hidden_productId != null)
            {
                this.hidden_productId.Value = this.productId.ToString();
            }
            if (this.promote != null)
            {
                this.promote.ProductId = this.productId;
            }
            int supplierId = productPreSaleBrowseInfo.Product.SupplierId;

            if (supplierId > 0)
            {
                SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                if (supplierById != null)
                {
                    this.hidSupplier.Value    = "true";
                    this.litSupplierName.Text = supplierById.SupplierName;
                }
            }
            else
            {
                this.hidSupplier.Value = "false";
            }
            MemberInfo user = HiContext.Current.User;

            if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productPreSaleBrowseInfo.Product.SubMemberDeduct.HasValue))
            {
                if (!productPreSaleBrowseInfo.Product.SubMemberDeduct.HasValue)
                {
                    goto IL_0c63;
                }
                decimal?subMemberDeduct = productPreSaleBrowseInfo.Product.SubMemberDeduct;
                if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue)
                {
                    goto IL_0c63;
                }
            }
            goto IL_0c89;
IL_0c89:
            int num2 = 1;

            goto IL_0c8a;
IL_0c8a:
            if (num2 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            if (this.rptProductImages != null)
            {
                string locationUrl = "javascript:;";
                if (string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl1) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl2) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl3) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl4) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl5))
                {
                    productPreSaleBrowseInfo.Product.ImageUrl1 = masterSettings.DefaultProductImage;
                }
                List <SlideImage> list = new List <SlideImage>();
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl1, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl2, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl3, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl4, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl5, locationUrl));
                this.rptProductImages.DataSource = from item in list
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.Text         = productPreSaleBrowseInfo.Product.ProductName;
            this.litShortDescription.Text    = productPreSaleBrowseInfo.Product.ShortDescription;
            this.divShortDescription.Visible = !string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ShortDescription);
            if (this.litDescription != null)
            {
                string text2 = "";
                Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                if (!string.IsNullOrWhiteSpace(productPreSaleBrowseInfo.Product.MobbileDescription))
                {
                    text2 = regex.Replace(productPreSaleBrowseInfo.Product.MobbileDescription, "");
                }
                else if (!string.IsNullOrWhiteSpace(productPreSaleBrowseInfo.Product.Description))
                {
                    text2 = regex.Replace(productPreSaleBrowseInfo.Product.Description, "");
                }
                text2 = text2.Replace("src", "data-url");
                this.litDescription.Text = text2;
            }
            Literal control = this.litSoldCount;

            num = productPreSaleBrowseInfo.Product.ShowSaleCounts;
            control.SetWhenIsNotNull(num.ToString());
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            Literal control2 = this.litConsultationsCount;

            num = productPreSaleBrowseInfo.ConsultationCount;
            control2.SetWhenIsNotNull(num.ToString());
            Literal control3 = this.litReviewsCount;

            num = productPreSaleBrowseInfo.ReviewCount;
            control3.SetWhenIsNotNull(num.ToString());
            MemberInfo user2 = HiContext.Current.User;
            bool       flag  = false;

            if (user2 != null)
            {
                flag = ProductBrowser.CheckHasCollect(user2.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            this.BindCouponList();
            PageTitle.AddSiteNameTitle(productPreSaleBrowseInfo.Product.ProductName);
            this.BindPromotionInfo();
            this.BindGuestProducts();
            DataTable dBConsultations = productPreSaleBrowseInfo.DBConsultations;

            for (int i = 0; i < dBConsultations.Rows.Count; i++)
            {
                dBConsultations.Rows[i]["UserName"] = DataHelper.GetHiddenUsername(dBConsultations.Rows[i]["UserName"].ToNullString());
            }
            this.rptProductConsultations.DataSource = dBConsultations;
            this.rptProductConsultations.DataBind();
            this.divConsultationEmpty.Visible = dBConsultations.IsNullOrEmpty();
            this.ulConsultations.Visible      = !dBConsultations.IsNullOrEmpty();
            return;

IL_0c63:
            if (HiContext.Current.SiteSettings.OpenReferral == 1)
            {
                num2 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0);
                goto IL_0c8a;
            }
            goto IL_0c89;
        }
Exemple #27
0
        protected void listOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                string      text        = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(text);
                if (orderInfo != null)
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        Literal literal = (Literal)e.Item.FindControl("litPresale");
                        literal.Text    = "(预售)";
                        literal.Visible = true;
                    }
                    OrderItemStatus itemStatus = orderInfo.ItemStatus;
                    DateTime        dateTime   = (DataBinder.Eval(e.Item.DataItem, "FinishDate") == DBNull.Value) ? DateTime.Now.AddYears(-1) : ((DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate"));
                    string          text2      = "";
                    if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                    {
                        text2 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                    }
                    HyperLink       hyperLink        = (HyperLink)e.Item.FindControl("hplinkorderreview");
                    HtmlAnchor      htmlAnchor       = (HtmlAnchor)e.Item.FindControl("hlinkPay");
                    ImageLinkButton imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
                    ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnCloseOrder");
                    HtmlAnchor      htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund");
                    HtmlAnchor      htmlAnchor3      = (HtmlAnchor)e.Item.FindControl("lkbtnUserRealNameVerify");
                    HyperLink       hyperLink2       = (HyperLink)e.Item.FindControl("hlinkOrderDetails");
                    Repeater        repeater         = (Repeater)e.Item.FindControl("rpProduct");
                    Repeater        repeater2        = (Repeater)e.Item.FindControl("rpGift");
                    Label           label            = (Label)e.Item.FindControl("Logistics");
                    HtmlAnchor      htmlAnchor4      = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                    HtmlAnchor      htmlAnchor5      = (HtmlAnchor)e.Item.FindControl("lkbtnRefundDetail");
                    htmlAnchor2.Attributes.Add("OrderId", text);
                    htmlAnchor2.Attributes.Add("SkuId", "");
                    htmlAnchor2.Attributes.Add("GateWay", text2);
                    OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                    Literal          literal2         = (Literal)e.Item.FindControl("lblGiftTitle");
                    orderStatusLabel.order = orderInfo;
                    if (orderInfo.LineItems.Count <= 0)
                    {
                        Literal literal3 = literal2;
                        literal3.Text += "(礼)";
                    }
                    if (hyperLink != null)
                    {
                        if (orderInfo.GetGiftQuantity() > 0 && orderInfo.LineItems.Count() == 0)
                        {
                            hyperLink.Visible = false;
                        }
                        else
                        {
                            HyperLink hyperLink3 = hyperLink;
                            int       visible;
                            switch (orderStatus)
                            {
                            case OrderStatus.Closed:
                                visible = ((orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count) ? 1 : 0);
                                break;

                            default:
                                visible = 0;
                                break;

                            case OrderStatus.Finished:
                                visible = 1;
                                break;
                            }
                            hyperLink3.Visible = ((byte)visible != 0);
                            if (hyperLink.Visible)
                            {
                                DataTable    productReviewAll = ProductBrowser.GetProductReviewAll(orderInfo.OrderId);
                                LineItemInfo lineItemInfo     = new LineItemInfo();
                                int          num  = 0;
                                int          num2 = 0;
                                int          num3 = 0;
                                bool         flag = false;
                                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                                {
                                    flag         = false;
                                    lineItemInfo = lineItem.Value;
                                    for (int i = 0; i < productReviewAll.Rows.Count; i++)
                                    {
                                        if (lineItemInfo.ProductId.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim())
                                        {
                                            flag = true;
                                        }
                                    }
                                    if (!flag)
                                    {
                                        num2++;
                                    }
                                    else
                                    {
                                        num3++;
                                    }
                                }
                                if (num + num2 == orderInfo.LineItems.Count)
                                {
                                    hyperLink.Text = "查看评论";
                                }
                                else
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                    if (masterSettings != null)
                                    {
                                        if (masterSettings.ProductCommentPoint <= 0)
                                        {
                                            hyperLink.Text = "评价";
                                        }
                                        else
                                        {
                                            hyperLink.Text = $"评价得{num3 * masterSettings.ProductCommentPoint}积分";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("FormatedMoneyLabel2");
                        formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment;
                        formatedMoneyLabel.Text  = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2");
                        if (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3)
                        {
                            if (!orderInfo.DepositDate.HasValue)
                            {
                                htmlAnchor.Visible = true;
                            }
                            else if (orderInfo.DepositDate.HasValue)
                            {
                                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                                if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && DateTime.Now <= productPreSaleInfo.PaymentEndDate)
                                {
                                    htmlAnchor.Visible = true;
                                }
                                else
                                {
                                    htmlAnchor.Visible = false;
                                }
                            }
                            else
                            {
                                htmlAnchor.Visible = false;
                            }
                        }
                        else
                        {
                            htmlAnchor.Visible = false;
                        }
                    }
                    else
                    {
                        htmlAnchor.Visible = (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3);
                    }
                    imageLinkButton.Visible = (orderStatus == OrderStatus.SellerAlreadySent && itemStatus == OrderItemStatus.Nomarl);
                    if (orderInfo.PreSaleId > 0)
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl && !orderInfo.DepositDate.HasValue);
                    }
                    else
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl);
                    }
                    RefundInfo refundInfo = TradeHelper.GetRefundInfo(text);
                    htmlAnchor2.Visible = ((orderInfo.FightGroupId > 0 && VShopHelper.IsFightGroupCanRefund(orderInfo.FightGroupId) && orderInfo.IsCanRefund) || (orderInfo.FightGroupId <= 0 && orderInfo.IsCanRefund));
                    htmlAnchor3.Visible = (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods);
                    if (htmlAnchor3.Visible)
                    {
                        htmlAnchor3.Attributes.Add("OrderId", text);
                    }
                    if (repeater != null && repeater2 != null)
                    {
                        repeater.ItemDataBound += this.listProduct_ItemDataBound;
                        IList <NewLineItemInfo> list = new List <NewLineItemInfo>();
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            NewLineItemInfo newLineItemInfo = this.GetNewLineItemInfo(value, orderInfo.OrderId);
                            list.Add(newLineItemInfo);
                        }
                        if (list == null || list.Count == 0)
                        {
                            repeater.Visible = false;
                            DataTable dataTable = (DataTable)(repeater2.DataSource = TradeHelper.GetOrderGiftsThumbnailsUrl(((DataRowView)e.Item.DataItem).Row["OrderId"].ToString()));
                            repeater2.DataBind();
                            repeater2.Visible = true;
                        }
                        else
                        {
                            repeater.DataSource = list;
                            repeater.DataBind();
                            repeater2.Visible = false;
                            repeater.Visible  = true;
                        }
                    }
                    if (refundInfo != null && orderInfo.ItemStatus == OrderItemStatus.Nomarl && (orderInfo.OrderStatus == OrderStatus.ApplyForRefund || orderInfo.OrderStatus == OrderStatus.RefundRefused || orderInfo.OrderStatus == OrderStatus.Closed))
                    {
                        htmlAnchor5.HRef    = "/user/UserRefundApplyDetails/" + refundInfo.RefundId;
                        htmlAnchor5.Visible = true;
                    }
                    hyperLink2.NavigateUrl = "/user/OrderDetails/" + orderInfo.OrderId;
                    if ((orderStatus == OrderStatus.SellerAlreadySent || orderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber) && orderInfo.ShippingModeId != -2)
                    {
                        label.Attributes.Add("action", "order");
                        label.Attributes.Add("orderId", text);
                        label.Visible = true;
                    }
                    if (orderInfo.FightGroupId > 0)
                    {
                        FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                        htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                    }
                    if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History)
                    {
                        WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                        bool flag2 = false;
                        if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                        {
                            flag2 = true;
                        }
                        if (flag2)
                        {
                            Image image = (Image)e.Item.FindControl("imgRedEnvelope");
                            image.ImageUrl = "../../../../common/images/SendRedEnvelope.png";
                            image.Attributes.Add("class", "ztitle_RedEnvelope");
                            image.Attributes.Add("onclick", "GetRedEnvelope(" + orderInfo.OrderId + ")");
                            image.Visible = true;
                        }
                    }
                    if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P"))
                    {
                        Label label2 = (Label)e.Item.FindControl("lblsupplier");
                        if (label2 != null)
                        {
                            string empty = string.Empty;
                            if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName))
                            {
                                label2.Text = orderInfo.StoreName;
                                empty       = "mtitle_1";
                            }
                            else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0)
                            {
                                label2.Text = orderInfo.ShipperName;
                                empty       = "stitle_1";
                            }
                            else
                            {
                                label2.Text = "平台";
                                empty       = "ztitle_1_new";
                            }
                            label2.Attributes.Add("style", string.IsNullOrWhiteSpace(label2.Text) ? "display:none" : "display:inline");
                            label2.Attributes.Add("class", empty);
                            label2.Visible = true;
                        }
                    }
                }
            }
        }
 private void BindOrderBase(OrderInfo order)
 {
     this.litBalanceAmount.Text = "-" + order.BalanceAmount.F2ToString("f2");
     this.hidPreSaleId.Value    = order.PreSaleId.ToString();
     this.litOrderId.Text       = order.OrderId;
     this.lbltotalPrice.Money   = order.GetAmount(false);
     this.litAddDate.Time       = order.OrderDate;
     this.litAddOrderDate.Time  = order.OrderDate;
     if (order.PreSaleId > 0)
     {
         this.lblDeposit.Money      = order.Deposit;
         this.lblFinalPayment.Money = order.FinalPayment;
         if (order.DepositDate.HasValue)
         {
             this.hidIsPayDeposit.Value  = "1";
             this.litDepositPayDate.Time = order.DepositDate;
             ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId);
             int num;
             if (!(order.PayDate == DateTime.MinValue))
             {
                 DateTime payDate = order.PayDate;
                 num = 0;
             }
             else
             {
                 num = 1;
             }
             DateTime dateTime;
             if (num != 0)
             {
                 if (order.OrderStatus != OrderStatus.Closed)
                 {
                     if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                     {
                         Literal literal = this.litFinalPamentPayDate;
                         dateTime     = productPreSaleInfo.PaymentStartDate;
                         literal.Text = dateTime.ToString("yyyy.MM.dd") + "后开始尾款支付";
                     }
                     else
                     {
                         Literal literal2 = this.litFinalPamentPayDate;
                         dateTime      = productPreSaleInfo.PaymentEndDate;
                         literal2.Text = dateTime.ToString("yyyy.MM.dd") + "后终止交易";
                     }
                 }
             }
             else
             {
                 Literal literal3 = this.litFinalPamentPayDate;
                 dateTime      = order.PayDate;
                 literal3.Text = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
             }
         }
     }
     else
     {
         this.litPayDate.Time = order.PayDate;
     }
     this.litShipDate.Time               = order.ShippingDate;
     this.litResultDate.Time             = order.FinishDate;
     this.lblOrderStatus.OrderStatusCode = order.OrderStatus;
     this.lblOrderStatus.OrderItemStatus = order.ItemStatus;
     this.lblOrderStatus.ShipmentModelId = order.ShippingModeId;
     this.lblOrderStatus.IsConfirm       = order.IsConfirm;
     this.lblOrderStatus.Gateway         = order.Gateway;
     this.lblOrderStatus.PaymentTypeId   = order.PaymentTypeId;
     this.lblOrderStatus.PreSaleId       = order.PreSaleId;
     this.lblOrderStatus.DepositDate     = order.DepositDate;
     if (order.OrderStatus == OrderStatus.Closed)
     {
         this.lbCloseReason.Visible = true;
         this.litCloseReason.Text   = order.CloseReason;
     }
     if (order.RefundAmount > decimal.Zero)
     {
         this.lbRefundMoney.Visible = true;
         this.lblRefundTotal.Money  = order.RefundAmount;
     }
     else
     {
         this.lbRefundMoney.Visible = false;
     }
     this.litRemark.Text = order.Remark;
     this.JudgeOrderStatus(order);
 }
Exemple #29
0
        public void LoadOrderInfo()
        {
            PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(ShoppingProcessor.GetPaymentGateway(EnumPaymentType.OfflinePay));

            if (paymentMode != null)
            {
                this.litOfflinePayContent.SetWhenIsNotNull(paymentMode.Description);
            }
            this.hidOrderid.Value = this.orderId;
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null || (orderInfo.UserId != 0 && orderInfo.UserId != HiContext.Current.UserId))
            {
                base.GotoResourceNotFound();
                return;
            }
            MemberInfo user = Users.GetUser(HiContext.Current.UserId);

            this.hidHasTradePassword.Value = (string.IsNullOrWhiteSpace(user.TradePassword) ? "0" : "1");
            if (orderInfo.ParentOrderId == "-1")
            {
                this.orderLink.HRef = base.GetRouteUrl("user_OrderList", new
                {
                    ParentOrderId = this.orderId
                });
                this.litOrderId.Text = OrderHelper.GetOrderIdsByParent(orderInfo.OrderId).Replace(",", "&nbsp;&nbsp;&nbsp;&nbsp;");
            }
            else
            {
                this.orderLink.HRef = base.GetRouteUrl("user_OrderDetails", new
                {
                    OrderId = this.orderId
                });
                this.litOrderId.Text = orderInfo.OrderId;
            }
            IList <string> paymentTypes = new List <string>();

            paymentTypes.Add("hishop.plugins.payment.podrequest");
            paymentTypes.Add("hishop.plugins.payment.bankrequest");
            paymentTypes.Add("hishop.plugins.payment.advancerequest");
            if (orderInfo.PreSaleId > 0)
            {
                this.litOrderPrice.Money = orderInfo.Deposit + orderInfo.FinalPayment;
            }
            else
            {
                this.litOrderPrice.Money = orderInfo.GetTotal(false);
            }
            if (orderInfo.PreSaleId > 0)
            {
                this.hidIsPreSale.Value = "1";
                if (!orderInfo.DepositDate.HasValue)
                {
                    this.litDeposittxt.Text = "定金:";
                    this.litDeposit.Money   = orderInfo.Deposit;
                }
                else
                {
                    this.litDeposittxt.Text = "尾款:";
                    this.litDeposit.Money   = orderInfo.FinalPayment;
                }
            }
            this.onlinePayPanel.Visible  = false;
            this.offlinePayPanel.Visible = false;
            int num;

            if ((orderInfo.PaymentTypeId != -3 || orderInfo.PaymentTypeId != -2) && orderInfo.Gateway != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentType != "到店支付" && orderInfo.Gateway != "hishop.plugins.payment.podrequest")
            {
                num = ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) ? 1 : 0);
                goto IL_02ea;
            }
            num = 0;
            goto IL_02ea;
IL_02ea:
            if (num != 0)
            {
                this.onlinePayPanel.Visible = true;
            }
            else if (orderInfo.Gateway == "hishop.plugins.payment.bankrequest")
            {
                this.offlinePayPanel.Visible = true;
            }
            string text = "";

            text = ((orderInfo.CountDownBuyId <= 0) ? (HiContext.Current.SiteSettings.CloseOrderDays + "天") : (HiContext.Current.SiteSettings.CountDownTime + "分钟"));
            PaymentModeInfo paymentMode2 = TradeHelper.GetPaymentMode("hishop.plugins.payment.podrequest");
            bool            flag         = false;

            if ((orderInfo.Gateway == "hishop.plugins.payment.podrequest" || (paymentMode2 != null && paymentMode2.ModeId == orderInfo.PaymentTypeId)) && orderInfo.PreSaleId <= 0)
            {
                flag = true;
            }
            switch (orderInfo.OrderStatus)
            {
            case OrderStatus.WaitBuyerPay:
                if (base.GetParameter("t", false).ToNullString() == "1")
                {
                    this.promptMsg.InnerHtml     = "银行系统可能会出现延时,如您已经支付,请耐心等待或者联系商家客服!";
                    this.msgTitle.InnerHtml      = "付款不成功,请重新支付!";
                    this.divfinish.Visible       = true;
                    this.onlinePayPanel.Visible  = false;
                    this.divOrderPayInfo.Visible = false;
                    this.imgPayResult.Src        = "/templates/pccommon/images/cart/ordererror.png";
                }
                if (orderInfo.PreSaleId > 0)
                {
                    if (orderInfo.DepositDate.HasValue)
                    {
                        this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。";
                        this.msgTitle.InnerHtml  = "恭喜您,您的定金已支付成功!";
                    }
                    else
                    {
                        this.promptMsg.InnerHtml = "请支付定金。";
                        this.msgTitle.InnerHtml  = "订单提交成功,请您尽快支付定金!";
                    }
                    this.divfinish.Visible = true;
                }
                if (flag)
                {
                    this.msgTitle.InnerHtml = "货到付款订单提交成功,平台将及时给您发货";
                }
                break;

            case OrderStatus.BuyerAlreadyPaid:
                if (orderInfo.PaymentType == "上门自提")
                {
                    this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您备货。";
                    this.msgTitle.InnerHtml  = "恭喜您,您的订单已支付成功!";
                }
                else
                {
                    this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您发货。";
                    this.msgTitle.InnerHtml  = "恭喜您,您的订单已支付成功!";
                }
                this.divfinish.Visible = true;
                break;

            case OrderStatus.Closed:
                this.promptMsg.InnerHtml = "您的订单已关闭,关闭原因:" + orderInfo.CloseReason + "。";
                this.msgTitle.InnerHtml  = "您的订单已关闭!";
                this.divfinish.Visible   = true;
                break;

            case OrderStatus.Finished:
                this.promptMsg.InnerHtml = "您的订单已完成.";
                this.msgTitle.InnerHtml  = "恭喜您,您的订单已完成!";
                this.divfinish.Visible   = true;
                break;

            case OrderStatus.SellerAlreadySent:
                this.promptMsg.InnerHtml = "您的订单已发货,请注意收货。";
                this.msgTitle.InnerHtml  = "恭喜您,您的订单已发货!";
                this.divfinish.Visible   = true;
                break;

            default:
                this.promptMsg.InnerHtml = "您的订单已提交成功。";
                this.divfinish.Visible   = true;
                break;
            }
            if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
            {
                this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您发货。";
            }
            else if (orderInfo.PaymentTypeId != -3 && !flag && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
            {
                DateTime dateTime;
                if (base.GetParameter("t", false).ToNullString() == "1")
                {
                    if (orderInfo.PreSaleId > 0 && orderInfo.DepositDate.HasValue)
                    {
                        this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。";
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            HtmlGenericControl htmlGenericControl = this.promptMsg;
                            string[]           obj = new string[5]
                            {
                                "定金支付成功,请您在",
                                null,
                                null,
                                null,
                                null
                            };
                            dateTime = productPreSaleInfo.PaymentStartDate;
                            obj[1]   = dateTime.ToString("yyyy-MM-dd");
                            obj[2]   = "至";
                            dateTime = productPreSaleInfo.PreSaleEndDate;
                            obj[3]   = dateTime.ToString("yyyy-MM-dd");
                            obj[4]   = "之间支付尾款,过期定金将不予以退还,请您谅解!";
                            htmlGenericControl.InnerHtml = string.Concat(obj);
                            this.onlinePayPanel.Visible  = false;
                        }
                    }
                    else
                    {
                        this.promptMsg.InnerHtml = "银行系统可能会出现延时,如您已经支付,请耐心等待或者联系商家客服!";
                    }
                }
                else if (orderInfo.PreSaleId > 0)
                {
                    if (orderInfo.DepositDate.HasValue)
                    {
                        this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。";
                        ProductPreSaleInfo productPreSaleInfo2 = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo2.PaymentStartDate > DateTime.Now)
                        {
                            HtmlGenericControl htmlGenericControl2 = this.promptMsg;
                            string[]           obj2 = new string[5]
                            {
                                "定金支付成功,请您在",
                                null,
                                null,
                                null,
                                null
                            };
                            dateTime = productPreSaleInfo2.PaymentStartDate;
                            obj2[1]  = dateTime.ToString("yyyy-MM-dd");
                            obj2[2]  = "至";
                            dateTime = productPreSaleInfo2.PaymentStartDate;
                            obj2[3]  = dateTime.ToString("yyyy-MM-dd");
                            obj2[4]  = "之间支付尾款,过期定金将不予以退还,请您谅解!";
                            htmlGenericControl2.InnerHtml = string.Concat(obj2);
                            this.onlinePayPanel.Visible   = false;
                        }
                    }
                    else
                    {
                        this.promptMsg.InnerHtml = "请您在订单提交后 <em>" + text + "</em>内完成定金支付,否则订单自动取消。";
                    }
                }
                else
                {
                    this.promptMsg.InnerHtml = "请您在订单提交后 <em>" + text + "</em>内完成支付,否则订单自动取消。";
                }
            }
            else if (flag)
            {
                this.promptMsg.InnerHtml = "您的订单选择了货到付款,平台将及时给您发货。";
            }
            else if (orderInfo.PaymentTypeId == -3)
            {
                this.promptMsg.InnerHtml = "您的订单选择了上门自提,门店正在备货中。";
            }
            if (this.onlinePayPanel.Visible)
            {
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add(new DataColumn("ModeId"));
                dataTable.Columns.Add(new DataColumn("Name"));
                dataTable.Columns.Add(new DataColumn("GateWay"));
                dataTable.Columns.Add(new DataColumn("Description"));
                dataTable.Columns.Add(new DataColumn("OutHtml"));
                IList <PaymentModeInfo> paymentModes = ShoppingProcessor.GetPaymentModes(PayApplicationType.payOnPC);
                paymentModes = (from item in paymentModes
                                where !paymentTypes.Contains(item.Gateway)
                                select item).ToList();
                if (HiContext.Current.UserId != 0 && HiContext.Current.User.IsOpenBalance)
                {
                    PaymentModeInfo paymentMode3 = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.advancerequest");
                    if (paymentMode3 != null)
                    {
                        this.AdvanceId.Value = paymentMode3.ModeId.ToString();
                        paymentModes.Add(paymentMode3);
                    }
                }
                if (paymentModes.Count == 0)
                {
                    this.ShowMessage("商城暂未配置支付方式,请稍后支付。", false, "", 1);
                    this.onlinePayPanel.Visible = false;
                }
                else
                {
                    decimal num2 = default(decimal);
                    if (HiContext.Current.User != null && HiContext.Current.User.UserId > 0)
                    {
                        num2 = HiContext.Current.User.Balance - HiContext.Current.User.RequestBalance;
                    }
                    string format  = "<a class=\"pic\"><b><img src=\"/pay/images/{0}.png\" alt=\"{1}\"></b> <span>{1}</span></a>";
                    string text2   = "<a class=\"name\"><em>{0}</em> <b>可用余额 ¥{1}</b> <span><a href=\"/user/RechargeRequest.aspx\" target=\"_blank\" style=\"line-height:4.5\">去充值</a></span></a>";
                    string format2 = "<a class=\"name\"><em>{0}</em></a>";
                    int    num3    = 0;
                    foreach (PaymentModeInfo item in paymentModes)
                    {
                        if (!(item.Gateway.ToLower() == "hishop.plugins.payment.advancerequest") && (orderInfo.FightGroupActivityId <= 0 || TradeHelper.GatewayIsCanBackReturn(item.Gateway) || !(item.Gateway.ToLower() != "hishop.plugins.payment.advancerequest")))
                        {
                            DataRow dataRow = dataTable.NewRow();
                            dataRow["ModeId"]      = item.ModeId;
                            dataRow["Name"]        = item.Name;
                            dataRow["Gateway"]     = item.Gateway;
                            dataRow["Description"] = item.Description;
                            if (!(item.Gateway.ToLower() == "hishop.plugins.payment.advancerequest"))
                            {
                                if (File.Exists(this.Page.Server.MapPath("/pay/images/" + item.Gateway + ".png")))
                                {
                                    dataRow["OutHtml"] = string.Format(format, item.Gateway, item.Name);
                                }
                                else
                                {
                                    dataRow["OutHtml"] = string.Format(format2, item.Name);
                                }
                                dataTable.Rows.Add(dataRow);
                                num3++;
                            }
                        }
                    }
                    this.paymentModeList.DataSource = dataTable;
                    this.paymentModeList.DataBind();
                }
            }
        }
Exemple #30
0
        private void dlstOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }
            string      orderId     = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
            OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(orderId);
            OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
            HtmlAnchor  htmlAnchor  = (HtmlAnchor)e.Item.FindControl("lkbtnCheckTake");
            Literal     literal     = (Literal)e.Item.FindControl("litCloseOrder");
            int         num         = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
            string      text        = "";

            if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
            {
                text = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
            }
            int              num2             = (int)((DataBinder.Eval(e.Item.DataItem, "GroupBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "GroupBuyId"));
            int              num3             = (int)((DataBinder.Eval(e.Item.DataItem, "CountDownBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "CountDownBuyId"));
            Label            label            = (Label)e.Item.FindControl("lkbtnSendGoods");
            ImageLinkButton  imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnPayOrder");
            ImageLinkButton  imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
            HtmlAnchor       htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
            ImageLinkButton  imageLinkButton3 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirm");
            int              num4             = (int)((DataBinder.Eval(e.Item.DataItem, "StoreId") == DBNull.Value) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "StoreId"));
            bool             flag             = (bool)((DataBinder.Eval(e.Item.DataItem, "IsStoreCollect") == DBNull.Value) ? ((object)false) : DataBinder.Eval(e.Item.DataItem, "IsStoreCollect"));
            OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");

            if (orderStatusLabel != null)
            {
                orderStatusLabel.OrderItemStatus = orderInfo.ItemStatus;
                if (orderInfo.PreSaleId > 0)
                {
                    orderStatusLabel.PreSaleId   = orderInfo.PreSaleId;
                    orderStatusLabel.DepositDate = orderInfo.DepositDate;
                }
            }
            bool       flag2      = false;
            RefundInfo refundInfo = TradeHelper.GetRefundInfo(orderId);

            if (refundInfo != null && orderInfo.StoreId == this.UserStoreId)
            {
                htmlAnchor2.Attributes.Add("refundid", refundInfo.RefundId.ToString());
                flag2 = true;
            }
            Literal literal2 = (Literal)e.Item.FindControl("group");

            if (literal2 != null)
            {
                if (num2 > 0)
                {
                    literal2.Text = "(团)";
                }
                if (num3 > 0)
                {
                    literal2.Text = "(抢)";
                }
                if (orderInfo.PreSaleId > 0)
                {
                    literal2.Text = "(预)";
                }
            }
            if (orderStatus == OrderStatus.WaitBuyerPay)
            {
                if (orderInfo.PreSaleId > 0)
                {
                    if (!orderInfo.DepositDate.HasValue)
                    {
                        literal.Visible = true;
                        if (text != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                    else
                    {
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && productPreSaleInfo.PaymentEndDate >= DateTime.Now && text != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                }
                else
                {
                    literal.Visible = true;
                    if (text != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                    {
                        imageLinkButton.Visible = true;
                    }
                }
            }
            if (text == "hishop.plugins.payment.podrequest" && (orderStatus == OrderStatus.WaitBuyerPay || orderStatus == OrderStatus.SellerAlreadySent))
            {
                literal.Visible = true;
            }
            if ((orderStatus == OrderStatus.ApplyForRefund && this.UserStoreId == num4) & flag)
            {
                htmlAnchor2.Visible = true;
            }
            if (num2 > 0)
            {
                string[] source = new string[1]
                {
                    "hishop.plugins.payment.podrequest"
                };
                GroupBuyStatus groupBuyStatus = (GroupBuyStatus)DataBinder.Eval(e.Item.DataItem, "GroupBuyStatus");
                Label          label2         = label;
                int            visible;
                switch (orderStatus)
                {
                case OrderStatus.WaitBuyerPay:
                    if (source.Contains(text))
                    {
                        goto case OrderStatus.BuyerAlreadyPaid;
                    }
                    goto default;

                case OrderStatus.BuyerAlreadyPaid:
                    if (groupBuyStatus == GroupBuyStatus.Success)
                    {
                        visible = ((orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                        break;
                    }
                    goto default;

                default:
                    visible = 0;
                    break;
                }
                label2.Visible = ((byte)visible != 0);
            }
            else
            {
                Label label3 = label;
                int   visible2;
                switch (orderStatus)
                {
                case OrderStatus.WaitBuyerPay:
                    if (text == "hishop.plugins.payment.podrequest")
                    {
                        goto case OrderStatus.BuyerAlreadyPaid;
                    }
                    goto default;

                case OrderStatus.BuyerAlreadyPaid:
                    visible2 = ((orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                    break;

                default:
                    visible2 = 0;
                    break;
                }
                label3.Visible = ((byte)visible2 != 0);
            }
            imageLinkButton2.Visible = (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
            HtmlAnchor htmlAnchor3;
            int        visible3;

            if (num == -2)
            {
                htmlAnchor3 = htmlAnchor;
                if ((orderStatus == OrderStatus.BuyerAlreadyPaid || orderStatus == OrderStatus.WaitBuyerPay) && orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                {
                    visible3 = (orderInfo.IsConfirm ? 1 : 0);
                    goto IL_05d6;
                }
                visible3 = 0;
                goto IL_05d6;
            }
            goto IL_0644;
IL_0631:
            int visible4 = (orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0;

            goto IL_063d;
IL_0644:
            LinkButton linkButton = (LinkButton)e.Item.FindControl("lbtnFightGroup");
            Image           image           = (Image)e.Item.FindControl("imgError");
            HtmlInputHidden htmlInputHidden = (HtmlInputHidden)e.Item.FindControl("hidFightGroup");

            image.Visible = orderInfo.IsError;
            if (orderInfo.IsError)
            {
                image.Attributes.Add("title", orderInfo.ErrorMessage);
                image.ImageUrl = "\\Admin\\images\\orderError.png";
            }
            if (orderInfo.FightGroupId > 0)
            {
                FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                if (fightGroup != null)
                {
                    if (fightGroup.Status == FightGroupStatus.FightGroupIn && orderInfo.OrderStatus != OrderStatus.WaitBuyerPay && orderInfo.OrderStatus != OrderStatus.Closed)
                    {
                        htmlInputHidden.Value = "1";
                    }
                    else
                    {
                        htmlInputHidden.Value = "0";
                    }
                }
            }
            else
            {
                linkButton.Visible = false;
            }
            return;

IL_05d6:
            htmlAnchor3.Visible = ((byte)visible3 != 0);
            literal.Visible     = (orderStatus == OrderStatus.WaitBuyerPay && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
            label.Visible       = false;
            ImageLinkButton imageLinkButton4 = imageLinkButton3;

            if (!orderInfo.IsConfirm)
            {
                if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && (text == "hishop.plugins.payment.podrequest" || orderInfo.PaymentTypeId == -3))
                {
                    goto IL_0631;
                }
                if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                {
                    goto IL_0631;
                }
            }
            visible4 = 0;
            goto IL_063d;
IL_063d:
            imageLinkButton4.Visible = ((byte)visible4 != 0);
            goto IL_0644;
        }