Exemple #1
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(base.GetParameter("productId", false), out this.productId))
            {
                base.GotoResourceNotFound();
            }
            this.hiddenpid               = (HtmlInputHidden)this.FindControl("hiddenpid");
            this.hidCartQuantity         = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.hiddenpid.Value         = this.productId.ToString();
            this.common_Location         = (Common_Location)this.FindControl("common_Location");
            this.litProductName          = (Literal)this.FindControl("litProductName");
            this.lblStock                = (StockLabel)this.FindControl("lblStock");
            this.litUnit                 = (Literal)this.FindControl("litUnit");
            this.litSaleCounts           = (Literal)this.FindControl("litSaleCounts");
            this.lblMarkerPrice          = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice");
            this.lblBuyPrice             = (Label)this.FindControl("lblBuyPrice");
            this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
            this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.btnBuy                  = (BuyButton)this.FindControl("btnBuy");
            this.btnaddgouwu             = (AddCartButton)this.FindControl("btnaddgouwu");
            this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
            this.ltlSaleCount            = (Literal)this.FindControl("ltlSaleCount");
            this.ltlReviewCount          = (Literal)this.FindControl("ltlReviewCount");
            this.litReviewCount          = (Literal)this.FindControl("litReviewCount");
            this.ltlConsultation         = (Literal)this.FindControl("ltlConsultation");
            this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
            this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
            this.rptOnlineService        = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService");
            this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
            this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
            this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.hidden_skuItem          = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidIsOpenMultiStore     = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore");
            this.aCountDownUrl           = (HyperLink)this.FindControl("aCountDownUrl");
            this.imgQrCode               = (Image)this.FindControl("imgQrCode");
            this.phonePriceQrCode        = (Image)this.FindControl("phonePriceQrCode");
            this.liCode                  = (HtmlGenericControl)this.FindControl("liCode");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divGift                 = (HtmlGenericControl)this.FindControl("divGift");
            this.ltlGiftName             = (Literal)this.FindControl("ltlGiftName");
            this.ltlGiftNum              = (Literal)this.FindControl("ltlGiftNum");
            this.aBrand                  = (HtmlAnchor)this.FindControl("aBrand");
            this.imgBrand                = (HiImage)this.FindControl("imgBrand");
            this.imgpdorequest           = (HtmlImage)this.FindControl("imgpdorequest");
            this.imgTakeonstore          = (HtmlImage)this.FindControl("imgTakeonstore");
            this.imgCustomerService      = (HtmlImage)this.FindControl("imgCustomerService");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.divOrderPromotions      = (HtmlGenericControl)this.FindControl("divOrderPromotions");
            this.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litPhonePriceEndDate    = (Literal)this.FindControl("litPhonePriceEndDate");
            this.divCuxiao               = (HtmlGenericControl)this.FindControl("divCuxiao");
            this.ltlUnit                 = (Literal)this.FindControl("ltlUnit");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.setDeliverRegion        = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion");
            this.hidShowCombinationBuy   = (HtmlInputHidden)this.FindControl("hidShowCombinationBuy");
            this.hidCombinationId        = (HtmlInputHidden)this.FindControl("hidCombinationId");
            this.imgMainPic              = (HtmlImage)this.FindControl("imgMainPic");
            this.divqq = (HtmlGenericControl)this.FindControl("divqq");
            HtmlAnchor htmlAnchor = (HtmlAnchor)this.FindControl("aMainName");

            this.lblMainPrice = (Label)this.FindControl("lblMainPrice");
            ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts");

            this.aCountDownUrl.Visible = false;
            if (this.Page.IsPostBack)
            {
                return;
            }
            if (this.imgQrCode != null)
            {
                string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png);
                this.imgQrCode.ImageUrl = text;
            }
            if (this.phonePriceQrCode != null)
            {
                string text2 = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text2, false, ImageFormats.Png);
                this.phonePriceQrCode.ImageUrl = text2;
            }
            if (this.liCode != null && HiContext.Current.SiteSettings.OpenAliho == 0 && HiContext.Current.SiteSettings.OpenVstore == 0 && HiContext.Current.SiteSettings.OpenWap == 0 && HiContext.Current.SiteSettings.OpenMobbile == 0)
            {
                this.liCode.Visible = false;
            }
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, 0);

            if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("/ProductDelete.aspx");
                return;
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnSale)
            {
                this.Page.Response.Redirect(base.GetRouteUrl("productdetails", new
                {
                    ProductId = this.productId
                }));
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
            {
                this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库"));
                return;
            }
            this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId;
            this.setDeliverRegion.Volume             = productBrowseInfo.Product.Weight;
            this.setDeliverRegion.Weight             = productBrowseInfo.Product.Weight;
            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId);
            }
            IEnumerable value = from item in productBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            this.hidden_productId.Value = this.productId.ToString();
            this.LoadPageSearch(productBrowseInfo.Product);
            if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage)
            {
                this.lbUserProductRefer.product = productBrowseInfo.Product;
            }
            HyperLink hyperLink = this.hpkProductConsultations;
            int       num       = productBrowseInfo.ConsultationCount;

            hyperLink.Text = "查看全部" + num.ToString() + "条咨询";
            Literal literal = this.ltlConsultation;

            num          = productBrowseInfo.ConsultationCount;
            literal.Text = num.ToString();
            Literal literal2 = this.ltlSaleCount;

            num           = productBrowseInfo.SaleCount;
            literal2.Text = num.ToString();
            Literal literal3 = this.ltlReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal3.Text = num.ToString();
            Literal literal4 = this.litReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal4.Text = num.ToString();
            this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}";
            this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
            this.btnBuy.Stock   = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            this.btnBuy.Visible = false;
            this.ltlUnit.Text   = productBrowseInfo.Product.Unit;
            this.divqq.Visible  = (this.sitesettings.ServiceIsOpen == "1");
            MemberInfo user = HiContext.Current.User;

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

            goto IL_0b4e;
IL_0b27:
            if (HiContext.Current.SiteSettings.OpenReferral == 1)
            {
                num2 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0);
                goto IL_0b4e;
            }
            goto IL_0b4d;
IL_0b4e:
            if (num2 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            this.btnaddgouwu.Stock   = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            this.btnaddgouwu.Visible = false;
            BrowsedProductQueue.EnQueue(this.productId);
            this.images.ImageInfo = productBrowseInfo.Product;
            if (productBrowseInfo.DbAttribute != null)
            {
                this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                this.rptExpandAttributes.DataBind();
            }
            if (productBrowseInfo.DbSKUs != null)
            {
                this.skuSelector.ProductId  = this.productId;
                this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
            }
            if (productBrowseInfo.Product.BrandId.HasValue)
            {
                BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo))
                {
                    this.imgBrand.ImageUrl = brandCategory.Logo;
                    this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                    {
                        brandId = brandCategory.BrandId
                    });
                }
            }
            if (SalesHelper.IsSupportPodrequest() && productBrowseInfo.Product.SupplierId == 0)
            {
                this.imgpdorequest.Visible = true;
            }
            if (SettingsManager.GetMasterSettings().OpenMultStore&& StoresHelper.ProductHasStores(this.productId) && productBrowseInfo.Product.SupplierId == 0)
            {
                this.imgTakeonstore.Visible = true;
            }
            if (productBrowseInfo.DBConsultations != null)
            {
                this.consultations.DataSource = productBrowseInfo.DBConsultations;
                this.consultations.DataBind();
            }
            if (productBrowseInfo.DbCorrelatives != null)
            {
                this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
                this.correlative.DataBind();
            }
            this.BindOrderPromotions();
            string productPromotionsInfo = this.GetProductPromotionsInfo();

            this.ltlProductSendGifts.Text = productPromotionsInfo;
            if (!this.divOrderPromotions.Visible && productPromotionsInfo == string.Empty)
            {
                this.divCuxiao.Style.Add("display", "none");
            }
            if (this.rptOnlineService != null)
            {
                IList <OnlineServiceInfo> allOnlineService  = OnlineServiceHelper.GetAllOnlineService(0, 1);
                IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2);
                if (allOnlineService2 != null)
                {
                    foreach (OnlineServiceInfo item in allOnlineService2)
                    {
                        allOnlineService.Add(item);
                    }
                }
                this.rptOnlineService.DataSource = allOnlineService;
                this.rptOnlineService.DataBind();
            }
        }
Exemple #2
0
        private void BindStoreData()
        {
            StoresInfo storeById = StoresHelper.GetStoreById(this.storeId);

            if (storeById == null)
            {
                base.Response.Redirect("StoresList.aspx");
            }
            else
            {
                IEnumerable <string> values = RegionHelper.GetFullRegion(storeById.RegionId, ",", true, 0).Split(',').Take(3);
                this.hfProvinceCityArea.Value = string.Join(",", values);
                this.txtWxAddress.Text        = string.Join(string.Empty, values) + storeById.Address;
                this.hidUploadImages.Value    = (string.IsNullOrEmpty(storeById.StoreImages) ? string.Empty : storeById.StoreImages);
                HiddenField hiddenField = this.hfLatitude;
                object      value;
                double      value2;
                if (!storeById.Latitude.HasValue)
                {
                    value = string.Empty;
                }
                else
                {
                    value2 = storeById.Latitude.Value;
                    value  = value2.ToString();
                }
                hiddenField.Value = (string)value;
                HiddenField hiddenField2 = this.hfLongitude;
                object      value3;
                if (!storeById.Longitude.HasValue)
                {
                    value3 = string.Empty;
                }
                else
                {
                    value2 = storeById.Longitude.Value;
                    value3 = value2.ToString();
                }
                hiddenField2.Value = (string)value3;
                TrimTextBox trimTextBox = this.txtWXAvgPrice;
                int?        wXAvgPrice  = storeById.WXAvgPrice;
                object      text;
                if (!wXAvgPrice.HasValue)
                {
                    text = string.Empty;
                }
                else
                {
                    wXAvgPrice = storeById.WXAvgPrice;
                    text       = wXAvgPrice.ToString();
                }
                trimTextBox.Text            = (string)text;
                this.txtWXIntroduction.Text = (string.IsNullOrEmpty(storeById.WXIntroduction) ? string.Empty : storeById.WXIntroduction);
                this.txtWXOpenTime.Text     = (string.IsNullOrEmpty(storeById.WXOpenTime) ? string.Empty : storeById.WXOpenTime);
                this.txtWXRecommend.Text    = (string.IsNullOrEmpty(storeById.WXRecommend) ? string.Empty : storeById.WXRecommend);
                this.txtWXSpecial.Text      = (string.IsNullOrEmpty(storeById.WXSpecial) ? string.Empty : storeById.WXSpecial);
                this.txtWXTelephone.Text    = (string.IsNullOrEmpty(storeById.WXTelephone) ? storeById.Tel : storeById.WXTelephone);
                string text2 = string.IsNullOrEmpty(storeById.WXCategoryName) ? string.Empty : storeById.WXCategoryName;
                if (!string.IsNullOrEmpty(text2))
                {
                    string selectedValue  = text2.Split(',')[0];
                    string selectedValue2 = text2.Split(',')[1];
                    this.ddlCategoryParent.SelectedValue = selectedValue;
                    this.BindCategoryChild();
                    this.ddlCategoryChild.SelectedValue = selectedValue2;
                }
            }
        }
Exemple #3
0
        private void QueryDeliverFees(HttpContext context)
        {
            StoresInfo   storeById      = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId);
            string       text           = context.Request["OrderIds"].ToNullString();
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (string.IsNullOrEmpty(text))
            {
                context.Response.Write(this.GetFailResultJson("订单号不能为空"));
            }
            else
            {
                string[] array = text.Split(',');
                IList <IDictionary <string, string> > list = new List <IDictionary <string, string> >();
                ShippersInfo defaultOrFirstShipper         = SalesHelper.GetDefaultOrFirstShipper(0);
                string[]     array2 = array;
                foreach (string text2 in array2)
                {
                    IDictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary.Add("OrderId", text2);
                    string    text3     = "";
                    OrderInfo orderInfo = TradeHelper.GetOrderInfo(text2);
                    if (orderInfo == null)
                    {
                        text3 = "错误的订单号";
                    }
                    if ((orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid && (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1)))) || orderInfo.RealShippingModeId == -2)
                    {
                        text3 = "错误的订单状态";
                    }
                    string text4 = "";
                    try
                    {
                        string  value   = DadaHelper.cityCodeList(masterSettings.DadaSourceID);
                        JObject jObject = JsonConvert.DeserializeObject(value) as JObject;
                        JArray  jArray  = (JArray)jObject["result"];
                        foreach (JToken item in (IEnumerable <JToken>)jArray)
                        {
                            if (orderInfo.ShippingRegion.Contains(item["cityName"].ToString()))
                            {
                                text4 = item["cityCode"].ToString();
                                break;
                            }
                        }
                    }
                    catch
                    {
                    }
                    if (text4 == "")
                    {
                        text3 = "配送范围超区,无法配送";
                    }
                    if (text3 != "")
                    {
                        dictionary.Add("Message", text3);
                        dictionary.Add("distance", "");
                        dictionary.Add("deliveryNo", "");
                        dictionary.Add("fee", "");
                        list.Add(dictionary);
                    }
                    else
                    {
                        string text5               = orderInfo.StoreId.ToNullString();
                        string orderId             = orderInfo.OrderId;
                        string city_code           = text4;
                        double cargo_price         = orderInfo.GetTotal(false).F2ToString("f2").ToDouble(0);
                        int    is_prepay           = 0;
                        long   expected_fetch_time = Globals.DateTimeToUnixTimestamp(DateTime.Now.AddMinutes(15.0));
                        string shipTo              = orderInfo.ShipTo;
                        string address             = orderInfo.Address;
                        string latLng              = orderInfo.LatLng;
                        if (string.IsNullOrWhiteSpace(latLng))
                        {
                            ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId);
                            latLng = shippingAddress.LatLng;
                        }
                        double  receiver_lat      = latLng.Split(',')[0].ToDouble(0);
                        double  receiver_lng      = latLng.Split(',')[1].ToDouble(0);
                        string  callback          = Globals.FullPath("/pay/dadaOrderNotify");
                        string  cellPhone         = orderInfo.CellPhone;
                        string  telPhone          = orderInfo.TelPhone;
                        bool    isQueryDeliverFee = true;
                        string  value2            = DadaHelper.addOrder(masterSettings.DadaSourceID, "P_" + defaultOrFirstShipper.ShipperId, orderId, city_code, cargo_price, is_prepay, expected_fetch_time, shipTo, address, receiver_lat, receiver_lng, callback, cellPhone, telPhone, -1.0, -1.0, -1.0, -1.0, -1L, "", -1, -1.0, -1, -1L, "", "", "", false, isQueryDeliverFee);
                        JObject jObject2          = JsonConvert.DeserializeObject(value2) as JObject;
                        string  a = jObject2["status"].ToString();
                        if (a == "success")
                        {
                            JObject jObject3 = JsonConvert.DeserializeObject(jObject2["result"].ToString()) as JObject;
                            dictionary.Add("Message", "");
                            dictionary.Add("distance", jObject3["distance"].ToNullString());
                            dictionary.Add("deliveryNo", jObject3["deliveryNo"].ToNullString());
                            dictionary.Add("fee", "预计运费:¥" + jObject3["fee"].ToNullString());
                        }
                        else
                        {
                            dictionary.Add("Message", jObject2["msg"].ToNullString());
                            dictionary.Add("distance", "");
                            dictionary.Add("deliveryNo", "");
                            dictionary.Add("fee", "");
                        }
                        list.Add(dictionary);
                    }
                }
                string s = JsonConvert.SerializeObject(new
                {
                    Result = new
                    {
                        Status = "SUCCESS",
                        List   = from r in list
                                 select new
                        {
                            OrderId    = r["OrderId"].ToNullString(),
                            Message    = r["Message"].ToNullString(),
                            distance   = r["distance"].ToNullString(),
                            fee        = r["fee"].ToNullString(),
                            deliveryNo = r["deliveryNo"].ToNullString()
                        }
                    }
                });
                context.Response.Write(s);
                context.Response.End();
            }
        }
Exemple #4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings();
            StoresInfo      storeById       = StoresHelper.GetStoreById(this.storeId);
            IList <string>  list            = new List <string>();
            CreateStoreData createStoreData = new CreateStoreData();

            if (string.IsNullOrEmpty(this.txtWxAddress.Text.Trim()) || this.txtWxAddress.Text.Trim().Length > 50)
            {
                this.ShowMsg("微信门店地址不能为空长度必须为2-50个字符", false);
            }
            else
            {
                string text = $"{this.ddlCategoryParent.SelectedValue.Trim()},{this.ddlCategoryChild.SelectedValue.Trim()}";
                if (string.IsNullOrEmpty(text) || text.Length > 50)
                {
                    this.ShowMsg("类目不能为空,长度必须为2-50个字符", false);
                }
                else if (string.IsNullOrEmpty(this.txtWXTelephone.Text.Trim()) || this.txtWXTelephone.Text.Trim().Length > 25)
                {
                    this.ShowMsg("电话不能为空,长度必须为2-50个字符", false);
                }
                else if (!string.IsNullOrEmpty(this.txtWXAvgPrice.Text.Trim()) && this.txtWXAvgPrice.Text.Trim().ToInt(0) <= 0)
                {
                    this.ShowMsg("人均价格必须大于零的整数,须如实填写,默认单位为人民币", false);
                }
                else
                {
                    string text2 = this.txtWXOpenTime.Text.Trim();
                    if (!string.IsNullOrEmpty(text2) && text2.Split('-').Length != 2)
                    {
                        this.ShowMsg("营业时间如,10:00-21:00", false);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(text2))
                        {
                            DateTime minValue = DateTime.MinValue;
                            string[] array    = text2.Split('-');
                            if (!DateTime.TryParse(array[0], out minValue) || !DateTime.TryParse(array[1], out minValue))
                            {
                                this.ShowMsg("营业时间如,10:00-21:00", false);
                                return;
                            }
                        }
                        if (!string.IsNullOrEmpty(this.txtWXRecommend.Text.Trim()) && this.txtWXRecommend.Text.Trim().Length > 150)
                        {
                            this.ShowMsg("推荐长度必须为2-150个字符", false);
                        }
                        else if (!string.IsNullOrEmpty(this.txtWXSpecial.Text.Trim()) && this.txtWXSpecial.Text.Trim().Length > 150)
                        {
                            this.ShowMsg("特色服务必须为2-150个字符", false);
                        }
                        else if (!string.IsNullOrEmpty(this.txtWXIntroduction.Text.Trim()) && this.txtWXIntroduction.Text.Trim().Length > 150)
                        {
                            this.ShowMsg("简介必须为2-150个字符", false);
                        }
                        else
                        {
                            string   text3  = this.hidUploadImages.Value.Trim();
                            string[] array2 = text3.Split(',');
                            for (int i = 0; i < array2.Length; i++)
                            {
                                if (!string.IsNullOrEmpty(array2[i]))
                                {
                                    string item = Globals.SaveFile("depot", array2[i], "/Storage/master/", true, false, "");
                                    list.Add(item);
                                }
                            }
                            IEnumerable <string> enumerable = WXStoreHelper.ImageUploadForStore(list);
                            foreach (string item2 in enumerable)
                            {
                                createStoreData.business.base_info.photo_list.Add(new Store_Photo
                                {
                                    photo_url = item2
                                });
                            }
                            string        address = this.txtWxAddress.Text.Trim();
                            List <string> list2   = RegionHelper.GetFullRegion(storeById.RegionId, ",", true, 0).Split(',').Take(3)
                                                    .ToList();
                            list2.ForEach(delegate(string c)
                            {
                                address = address.Replace(c, string.Empty);
                            });
                            createStoreData.business.base_info.address       = address;
                            createStoreData.business.base_info.avg_price     = this.txtWXAvgPrice.Text.ToInt(0);
                            createStoreData.business.base_info.branch_name   = storeById.StoreName;
                            createStoreData.business.base_info.business_name = masterSettings.SiteName;
                            createStoreData.business.base_info.categories    = new string[1]
                            {
                                $"{this.ddlCategoryParent.SelectedValue.Trim()},{this.ddlCategoryChild.SelectedValue.Trim()}"
                            };
                            createStoreData.business.base_info.city         = list2[1];
                            createStoreData.business.base_info.district     = this.hfDistrict.Value;
                            createStoreData.business.base_info.introduction = this.txtWXIntroduction.Text.Trim();
                            createStoreData.business.base_info.latitude     = this.hfLatitude.Value;
                            createStoreData.business.base_info.longitude    = this.hfLongitude.Value;
                            createStoreData.business.base_info.offset_type  = 1;
                            createStoreData.business.base_info.open_time    = this.txtWXOpenTime.Text.Trim();
                            createStoreData.business.base_info.province     = list2[0];
                            createStoreData.business.base_info.recommend    = this.txtWXRecommend.Text.Trim();
                            createStoreData.business.base_info.special      = this.txtWXSpecial.Text.Trim();
                            createStoreData.business.base_info.telephone    = this.txtWXTelephone.Text.Trim();
                            storeById.StoreImages = ((list.Count == 0) ? string.Empty : string.Join(",", list.ToArray()));
                            createStoreData.business.base_info.sid = this.storeId.ToString();
                            WxJsonResult wxJsonResult = WXStoreHelper.CreateWXStore(createStoreData);
                            if (wxJsonResult.errcode.Equals(ReturnCode.请求成功))
                            {
                                StoresHelper.FirstAddWXStore(createStoreData, this.storeId, storeById.StoreImages);
                            }
                            this.ShowMsg("添加成功,等待微信审核", true, "StoresList.aspx");
                        }
                    }
                }
            }
        }
Exemple #5
0
 protected override void AttachChildControls()
 {
     PageTitle.AddSiteNameTitle("门店首页");
     this.storeLogo      = (HtmlImage)this.FindControl("storeLogo");
     this.litStoreName   = (Literal)this.FindControl("litStoreName");
     this.litStoreName2  = (Literal)this.FindControl("litStoreName2");
     this.litOpenDate    = (Literal)this.FindControl("litOpenDate");
     this.litStoreDelive = (Literal)this.FindControl("litStoreDelive");
     this.hidLatitude    = (HtmlInputHidden)this.FindControl("hidLatitude");
     this.hidLongitude   = (HtmlInputHidden)this.FindControl("hidLongitude");
     this.rp_markting    = (Repeater)this.FindControl("rp_markting");
     int.TryParse(this.Page.Request.QueryString["storeId"], out this.storeId);
     if (this.storeId > 0)
     {
         StoresInfo storeById = StoresHelper.GetStoreById(this.storeId);
         if (storeById != null)
         {
             this.storeLogo.Src = storeById.StoreImages;
             Literal  literal  = this.litStoreName;
             Literal  literal2 = this.litStoreName2;
             string   text2    = literal.Text = (literal2.Text = storeById.StoreName);
             string   text3    = (storeById.OpenEndDate < storeById.OpenStartDate) ? "次日" : "";
             Literal  literal3 = this.litOpenDate;
             DateTime dateTime = storeById.OpenStartDate;
             string   arg      = dateTime.ToString("HH:mm");
             string   arg2     = text3;
             dateTime      = storeById.OpenEndDate;
             literal3.Text = string.Format("{0} 至 {1}{2}", arg, arg2, dateTime.ToString("HH:mm"));
             HtmlInputHidden htmlInputHidden = this.hidLatitude;
             double?         nullable        = storeById.Latitude;
             htmlInputHidden.Value = nullable.ToString();
             HtmlInputHidden htmlInputHidden2 = this.hidLongitude;
             nullable = storeById.Longitude;
             htmlInputHidden2.Value = nullable.ToString();
             if (storeById.IsStoreDelive)
             {
                 decimal?minOrderPrice = storeById.MinOrderPrice;
                 int     num;
                 if (minOrderPrice.GetValueOrDefault() > default(decimal) && minOrderPrice.HasValue)
                 {
                     Literal literal4 = this.litStoreDelive;
                     num           = storeById.MinOrderPrice.ToInt(0);
                     literal4.Text = $"¥{num.ToString()}起送,";
                 }
                 minOrderPrice = storeById.StoreFreight;
                 if (minOrderPrice.GetValueOrDefault() > default(decimal) && minOrderPrice.HasValue)
                 {
                     Literal literal5 = this.litStoreDelive;
                     string  text4    = literal5.Text;
                     num           = storeById.StoreFreight.ToInt(0);
                     literal5.Text = text4 + $"配送费¥{num.ToString()}";
                 }
                 else
                 {
                     Literal literal6 = this.litStoreDelive;
                     literal6.Text += "免配送费";
                 }
             }
             if (this.rp_markting != null)
             {
                 List <StoreMarktingInfo> storeMarktingInfoList = StoreMarktingHelper.GetStoreMarktingInfoList();
                 this.rp_markting.DataSource = storeMarktingInfoList;
                 this.rp_markting.DataBind();
             }
             PageTitle.AddSiteNameTitle(storeById.StoreName);
         }
     }
 }
        private void printdata()
        {
            StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId);

            if (storeById != null)
            {
                this.mailNo = this.txtStartCode.Text.Trim();
                string text = HttpContext.Current.Request.MapPath($"../../Storage/master/flex/{this.ddlTemplates.SelectedValue}");
                if (File.Exists(text))
                {
                    XmlDocument xmlDocument = new XmlDocument();
                    xmlDocument.XmlResolver = null;
                    xmlDocument.Load(text);
                    XmlNode xmlNode = xmlDocument.DocumentElement.SelectSingleNode("//printer");
                    this.templateName = xmlNode.SelectSingleNode("kind").InnerText;
                    string innerText  = xmlNode.SelectSingleNode("pic").InnerText;
                    string innerText2 = xmlNode.SelectSingleNode("size").InnerText;
                    this.width  = innerText2.Split(':')[0];
                    this.height = innerText2.Split(':')[1];
                    IList <OrderInfo> printDataList = this.GetPrintDataList(BatchPrintData.orderIds);
                    this.pringrows = printDataList.Count;
                    foreach (OrderInfo item in printDataList)
                    {
                        this.UpdateOrderIds = this.UpdateOrderIds + item.OrderId + ",";
                        string[] array = item.ShippingRegion.ToString().Split(',');
                        foreach (XmlNode item2 in xmlNode.SelectNodes("item"))
                        {
                            string   text2      = string.Empty;
                            string   innerText3 = item2.SelectSingleNode("name").InnerText;
                            string   innerText4 = item2.SelectSingleNode("position").InnerText;
                            string   text3      = innerText4.Split(':')[0];
                            string   text4      = innerText4.Split(':')[1];
                            string   text5      = innerText4.Split(':')[2];
                            string   text6      = innerText4.Split(':')[3];
                            string   str        = text6 + "," + text5 + "," + text3 + "," + text4;
                            string[] array2     = new string[3]
                            {
                                "",
                                "",
                                ""
                            };
                            array2 = RegionHelper.GetFullRegion(storeById.RegionId, "-", true, 0).Split('-');
                            string text7 = string.Empty;
                            if (innerText3.Split('_')[0] == "收货人-姓名")
                            {
                                this.ShipTo = this.ShipTo + "'" + this.ReplaceString(item.ShipTo) + "',";
                                if (!string.IsNullOrEmpty(item.ShipTo))
                                {
                                    this.SizeShipTo = this.SizeShipTo + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeShipTo += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "收货人-电话")
                            {
                                this.ShipTelPhone = this.ShipTelPhone + "'" + item.TelPhone + "',";
                                if (!string.IsNullOrEmpty(item.TelPhone))
                                {
                                    this.SizeShipTelPhone = this.SizeShipTelPhone + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeShipTelPhone += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "收货人-手机")
                            {
                                this.ShipCellPhone = this.ShipCellPhone + "'" + item.CellPhone + "',";
                                if (!string.IsNullOrEmpty(item.CellPhone))
                                {
                                    this.SizeShipCellPhone = this.SizeShipCellPhone + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeShipCellPhone += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "收货人-邮编")
                            {
                                this.ShipZipCode = this.ShipZipCode + "'" + item.ZipCode + "',";
                                if (!string.IsNullOrEmpty(item.ZipCode))
                                {
                                    this.SizeShipZipCode = this.SizeShipZipCode + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeShipZipCode += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "收货人-地址")
                            {
                                this.ShipAddress = this.ShipAddress + "'" + this.ReplaceString(item.Address) + "',";
                                if (!string.IsNullOrEmpty(item.Address.Trim()))
                                {
                                    this.ShipSizeAddress = this.ShipSizeAddress + "'" + str + "',";
                                }
                                else
                                {
                                    this.ShipSizeAddress += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "收货人-地区1级")
                            {
                                if (array.Length != 0)
                                {
                                    text2 = array[0];
                                }
                                this.ShipProvince = this.ShipProvince + "'" + text2 + "',";
                                if (!string.IsNullOrEmpty(text2.Trim()))
                                {
                                    this.ShipSizeProvnce = this.ShipSizeProvnce + "'" + str + "',";
                                }
                                else
                                {
                                    this.ShipSizeProvnce += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "收货人-地区2级")
                            {
                                text2 = string.Empty;
                                if (array.Length > 1)
                                {
                                    text2 = array[1];
                                }
                                this.ShipCity = this.ShipCity + "'" + text2 + "',";
                                if (!string.IsNullOrEmpty(text2.Trim()))
                                {
                                    this.ShipSizeCity = this.ShipSizeCity + "'" + str + "',";
                                }
                                else
                                {
                                    this.ShipSizeCity += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "目的地-地区")
                            {
                                text2 = string.Empty;
                                if (array.Length > 1)
                                {
                                    text2 = array[1];
                                }
                                this.Destination = this.Destination + "'" + text2 + "',";
                                if (!string.IsNullOrEmpty(text2.Trim()))
                                {
                                    this.SizeDestination = this.SizeDestination + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeDestination += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "收货人-地区3级")
                            {
                                text2 = string.Empty;
                                if (array.Length > 2)
                                {
                                    text2 = array[2];
                                }
                                this.ShipDistrict = this.ShipDistrict + "'" + text2 + "',";
                                if (!string.IsNullOrEmpty(text2.Trim()))
                                {
                                    this.ShipSizeDistrict = this.ShipSizeDistrict + "'" + str + "',";
                                }
                                else
                                {
                                    this.ShipSizeDistrict += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "送货-上门时间")
                            {
                                this.ShipToDate = this.ShipToDate + "'" + item.ShipToDate + "',";
                                if (!string.IsNullOrEmpty(item.ShipToDate.Trim()))
                                {
                                    this.SizeShipToDate = this.SizeShipToDate + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeShipToDate += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "订单-订单号")
                            {
                                this.OrderId = this.OrderId + "'订单号:" + item.OrderId + "',";
                                if (!string.IsNullOrEmpty(item.OrderId.Trim()))
                                {
                                    this.SizeOrderId = this.SizeOrderId + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeOrderId += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "订单-总金额")
                            {
                                decimal total = item.GetTotal(false);
                                if (!string.IsNullOrEmpty(total.ToString().Trim()))
                                {
                                    this.OrderTotal = this.OrderTotal + "'" + item.GetTotal(false).F2ToString("f2") + "',";
                                }
                                total = item.GetTotal(false);
                                if (!string.IsNullOrEmpty(total.ToString().Trim()))
                                {
                                    this.SizeOrderTotal = this.SizeOrderTotal + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeOrderTotal += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "订单-详情")
                            {
                                string text8 = string.Empty;
                                foreach (LineItemInfo value2 in item.LineItems.Values)
                                {
                                    if (value2.Status == LineItemStatus.Normal || value2.Status == LineItemStatus.RefundRefused || value2.Status == LineItemStatus.ReturnsRefused || value2.Status == LineItemStatus.ReplaceRefused || value2.Status == LineItemStatus.Replaced)
                                    {
                                        text8 = text8 + "规格" + value2.SKUContent + " 数量" + value2.ShipmentQuantity + "货号 :" + value2.SKU;
                                    }
                                }
                                text8 = text8.Replace(";", "");
                                if (!string.IsNullOrEmpty(text8.Trim()))
                                {
                                    this.SizeitemInfos = this.SizeitemInfos + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeitemInfos += "'0,0,0,0',";
                                }
                                this.ShipitemInfos = this.ShipitemInfos + "'" + this.ReplaceString(text8) + "',";
                            }
                            if (innerText3.Split('_')[0] == "订单-物品总重量")
                            {
                                decimal weight = item.Weight;
                                this.Shipitemweith = this.Shipitemweith + "'" + weight.F2ToString("f2") + "',";
                                if (!string.IsNullOrEmpty(weight.ToString().Trim()))
                                {
                                    this.SizeShipitemweith = this.SizeShipitemweith + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeShipitemweith += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "订单-备注")
                            {
                                this.Remark = this.Remark + "'" + this.ReplaceString(item.Remark) + "',";
                                if (!string.IsNullOrEmpty(item.Remark.Trim()))
                                {
                                    this.SizeRemark = this.SizeRemark + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeRemark += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "发货人-姓名")
                            {
                                this.ShipperName = this.ShipperName + "'" + this.ReplaceString(storeById.ContactMan) + "',";
                                if (!string.IsNullOrEmpty(storeById.ContactMan.Trim()))
                                {
                                    this.SizeShipperName = this.SizeShipperName + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeShipperName += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "发货人-电话")
                            {
                                this.TelPhone = this.TelPhone + "'" + storeById.Tel + "',";
                                if (!string.IsNullOrEmpty(storeById.Tel.Trim()))
                                {
                                    this.SizeTelPhone = this.SizeTelPhone + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeTelPhone += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "发货人-手机")
                            {
                                this.CellPhone = this.CellPhone + "'" + storeById.Tel + "',";
                                if (!string.IsNullOrEmpty(storeById.Tel.Trim()))
                                {
                                    this.SizeCellPhone = this.SizeCellPhone + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeCellPhone += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "发货人-邮编")
                            {
                                this.Zipcode += "'',";
                                if (!string.IsNullOrEmpty(""))
                                {
                                    this.SizeZipcode = this.SizeZipcode + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeZipcode += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "发货人-地址")
                            {
                                this.Address = this.Address + "'" + this.ReplaceString(storeById.Address) + "',";
                                if (!string.IsNullOrEmpty(storeById.Address.Trim()))
                                {
                                    this.SizeAddress = this.SizeAddress + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeAddress += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "发货人-地区1级")
                            {
                                if (array2.Length != 0)
                                {
                                    text7 = array2[0];
                                }
                                this.Province = this.Province + "'" + text7 + "',";
                                if (!string.IsNullOrEmpty(text7.Trim()))
                                {
                                    this.SizeProvnce = this.SizeProvnce + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeProvnce += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "发货人-地区2级")
                            {
                                text7 += string.Empty;
                                if (array2.Length > 1)
                                {
                                    text7 = array2[1];
                                }
                                this.City = this.City + "'" + text7 + "',";
                                if (!string.IsNullOrEmpty(text7.Trim()))
                                {
                                    this.SizeCity = this.SizeCity + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeCity += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "始发地-地区")
                            {
                                text7 += string.Empty;
                                if (array2.Length > 1)
                                {
                                    text7 = array2[1];
                                }
                                this.Departure = this.Departure + "'" + text7 + "',";
                                if (!string.IsNullOrEmpty(text7.Trim()))
                                {
                                    this.SizeDeparture = this.SizeDeparture + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeDeparture += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "发货人-地区3级")
                            {
                                text7 += string.Empty;
                                if (array2.Length > 2)
                                {
                                    text7 = array2[2];
                                }
                                this.District = this.District + "'" + text7 + "',";
                                if (!string.IsNullOrEmpty(text7.Trim()))
                                {
                                    this.SizeDistrict = this.SizeDistrict + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeDistrict += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('_')[0] == "网店名称")
                            {
                                this.SiteName = this.SiteName + "'" + this.ReplaceString(HiContext.Current.SiteSettings.SiteName) + "',";
                                if (!string.IsNullOrEmpty(HiContext.Current.SiteSettings.SiteName.Trim()))
                                {
                                    this.SizeSiteName = this.SizeSiteName + "'" + str + "',";
                                }
                                else
                                {
                                    this.SizeSiteName += "'0,0,0,0',";
                                }
                            }
                            if (innerText3.Split('-')[0] == "自定义")
                            {
                                string text9           = this.ReplaceString(innerText3.Split('-')[1].Split('_')[0]);
                                string definedDataItem = this.GetDefinedDataItem(this.ReplaceString(text9));
                                if (this.CustomeList.ContainsKey(text9))
                                {
                                    Dictionary <string, string> sizeCustomeList;
                                    string key;
                                    if (!string.IsNullOrEmpty(definedDataItem))
                                    {
                                        sizeCustomeList      = this.SizeCustomeList;
                                        key                  = text9;
                                        sizeCustomeList[key] = sizeCustomeList[key] + "'" + str + "',";
                                    }
                                    else
                                    {
                                        sizeCustomeList       = this.SizeCustomeList;
                                        key                   = text9;
                                        sizeCustomeList[key] += "'0,0,0,0',";
                                    }
                                    sizeCustomeList      = this.CustomeList;
                                    key                  = text9;
                                    sizeCustomeList[key] = sizeCustomeList[key] + "'" + definedDataItem + "',";
                                }
                                else
                                {
                                    string value = "'" + definedDataItem + "',";
                                    string str2  = "";
                                    str2 = (string.IsNullOrEmpty(definedDataItem) ? (str2 + "'0,0,0,0',") : (str2 + "'" + str + "',"));
                                    this.SizeCustomeList.Add(text9, str2);
                                    this.CustomeList.Add(text9, value);
                                }
                            }
                        }
                    }
                    this.UpdateOrderIds = this.UpdateOrderIds.TrimEnd(',');
                    this.PrintPage(this.width, this.height);
                }
            }
        }
Exemple #7
0
 private string GetAlias(string device_id)
 {
     return(StoresHelper.GetAlias(device_id));
 }
        private void SaveNewStock(bool isbatch)
        {
            List <StoreSKUInfo> list = new List <StoreSKUInfo>();
            int storeId = HiContext.Current.Manager.StoreId;
            List <StoreStockLogInfo> list2 = new List <StoreStockLogInfo>();
            int num = 0;

            if (this.grdSelectedProducts.Items.Count > 0)
            {
                foreach (RepeaterItem item in this.grdSelectedProducts.Items)
                {
                    TextBox textBox = item.FindControl("txtStock") as TextBox;
                    num = (isbatch ? this.txtTagetStock.Text.Trim().ToInt(0) : textBox.Text.Trim().ToInt(0));
                    if (num >= 0)
                    {
                        HiddenField hiddenField  = item.FindControl("txtOldStock") as HiddenField;
                        HiddenField hiddenField2 = item.FindControl("hidSKUContent") as HiddenField;
                        TextBox     textBox2     = item.FindControl("txtRemark") as TextBox;
                        int         num2         = hiddenField.Value.Trim().ToInt(0);
                        if (num != num2)
                        {
                            HiddenField  hiddenField3 = item.FindControl("HidSkuId") as HiddenField;
                            HiddenField  hiddenField4 = item.FindControl("HidProductId") as HiddenField;
                            string       value        = hiddenField3.Value;
                            int          num3         = hiddenField4.Value.ToInt(0);
                            StoreSKUInfo storeSKUInfo = new StoreSKUInfo();
                            storeSKUInfo.ProductID = num3;
                            storeSKUInfo.SkuId     = value;
                            storeSKUInfo.Stock     = num;
                            storeSKUInfo.StoreId   = storeId;
                            list.Add(storeSKUInfo);
                            StoreStockLogInfo storeStockLogInfo = new StoreStockLogInfo();
                            storeStockLogInfo.ProductId  = num3;
                            storeStockLogInfo.Remark     = DataHelper.CleanSearchString(string.IsNullOrEmpty(textBox2.Text.Trim()) ? this.txtComment.Text.Trim() : textBox2.Text.Trim());
                            storeStockLogInfo.SkuId      = value;
                            storeStockLogInfo.Operator   = HiContext.Current.Manager.UserName;
                            storeStockLogInfo.StoreId    = storeId;
                            storeStockLogInfo.ChangeTime = DateTime.Now;
                            storeStockLogInfo.Content    = hiddenField2.Value + "库存由【" + num2 + "】修改为【" + num + "】";
                            list2.Add(storeStockLogInfo);
                        }
                    }
                }
                if (list.Count > 0)
                {
                    if (StoresHelper.SaveStoreStock(list, list2, 1))
                    {
                        base.CloseWindow(null);
                        this.BindProduct();
                    }
                    else
                    {
                        this.ShowMsg("保存失败!", false);
                    }
                }
                else
                {
                    base.CloseWindow(null);
                }
            }
        }
        protected override void AttachChildControls()
        {
            this.hidSupplier             = (HtmlInputHidden)this.FindControl("hidSupplier");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.fightGroupRule          = (Common_FightGroupRule)this.FindControl("fightGroupRule");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litConsultationsCount   = (Literal)this.FindControl("litConsultationsCount");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.divFightGroupsHead      = (HtmlControl)this.FindControl("divFightGroupsHead");
            this.skuSubmitOrder          = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.fightGroupActivityId    = this.Page.Request["fightGroupActivityId"].ToInt(0);
            this.litJoinNumber           = (Literal)this.FindControl("litJoinNumber");
            this.litLimitedHour          = (Literal)this.FindControl("litLimitedHour");
            this.litEndDate            = (Literal)this.FindControl("litEndDate");
            this.litProductName        = (Literal)this.FindControl("litProductName");
            this.litFGAPrice           = (Literal)this.FindControl("litFGAPrice");
            this.litPPrice             = (Literal)this.FindControl("litPPrice");
            this.litProductReviewCount = (Literal)this.FindControl("litProductReviewCount");
            this.imgEnd          = (Image)this.FindControl("imgEnd");
            this.hlProductReview = (HyperLink)this.FindControl("hlProductReview");
            this.rptFightGroups  = (WapTemplatedRepeater)this.FindControl("rptFightGroups");
            this.litMinPrice     = (Literal)this.FindControl("litMinPrice");
            this.litProductPrice = (Literal)this.FindControl("litProductPrice");
            this.lblStock        = (StockLabel)this.FindControl("lblStock");
            this.litUnit         = (Literal)this.FindControl("litUnit");
            this.divGetBySelf    = (HtmlControl)this.FindControl("divGetBySelf");
            this.hiddenProductId = (HtmlInputText)this.FindControl("hiddenProductId");
            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");
            FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(this.fightGroupActivityId);

            if (fightGroupActivitieInfo != null)
            {
                HtmlInputText htmlInputText = this.hiddenProductId;
                int           num           = fightGroupActivitieInfo.ProductId;
                htmlInputText.Value = num.ToString();
                this.fightGroupRule.FightGroupActivityId = fightGroupActivitieInfo.FightGroupActivityId;
                if (fightGroupActivitieInfo.StartDate > DateTime.Now)
                {
                    this.Page.Response.Redirect("FightGroupActivityDetailsSoon.aspx?fightGroupActivityId=" + this.fightGroupActivityId);
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                if (masterSettings.OpenMultStore && StoresHelper.ProductHasStores(fightGroupActivitieInfo.ProductId))
                {
                    this.divGetBySelf.Visible = true;
                }
                this.skuSubmitOrder.FightGroupActivityId = fightGroupActivitieInfo.FightGroupActivityId;
                IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(this.fightGroupActivityId);
                this.hlProductReview.NavigateUrl = $"/vshop/ProductReview.aspx?ProductId={fightGroupActivitieInfo.ProductId}";
                this.imgEnd.Visible = (fightGroupActivitieInfo.EndDate < DateTime.Now);
                Literal literal = this.litJoinNumber;
                num          = fightGroupActivitieInfo.JoinNumber;
                literal.Text = num.ToString();
                Literal literal2 = this.litLimitedHour;
                num                      = fightGroupActivitieInfo.LimitedHour;
                literal2.Text            = num.ToString();
                this.litEndDate.Text     = fightGroupActivitieInfo.EndDate.ToString("yy.MM.dd");
                this.litProductName.Text = fightGroupActivitieInfo.ProductName;
                decimal num2 = fightGroupSkus.Min((FightGroupSkuInfo c) => c.SalePrice);
                this.litFGAPrice.Text = num2.F2ToString("f2");
                if (fightGroupSkus.Count() > 1)
                {
                    decimal num3 = fightGroupSkus.Max((FightGroupSkuInfo c) => c.SalePrice);
                    if (num3 > num2)
                    {
                        this.litFGAPrice.Text = num2.F2ToString("f2") + "~" + num3.F2ToString("f2");
                    }
                }
                this.litMinPrice.Text = num2.F2ToString("f2");
                IList <int> list = null;
                Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >);
                ProductInfo productDetails = ProductHelper.GetProductDetails(fightGroupActivitieInfo.ProductId, out dictionary, out list);
                if (productDetails != null)
                {
                    this.skuSubmitOrder.ProductInfo = productDetails;
                    this.litPPrice.Text             = MemberProcessor.GetMemberPrice(productDetails).F2ToString("f2");
                    this.litProductPrice.Text       = this.litPPrice.Text;
                }
                int supplierId = productDetails.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";
                }
                Literal literal3 = this.litProductReviewCount;
                num = ProductBrowser.GetProductReviews(new ProductReviewQuery
                {
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    ProductId = fightGroupActivitieInfo.ProductId
                }).TotalRecords;
                literal3.Text = num.ToString();
                DataTable fightGroups = VShopHelper.GetFightGroups(this.fightGroupActivityId);
                for (int i = 0; i < fightGroups.Rows.Count; i++)
                {
                    fightGroups.Rows[i]["Name"] = DataHelper.GetHiddenUsername(fightGroups.Rows[i]["Name"].ToString());
                }
                this.divFightGroupsHead.Visible = (fightGroups.Rows.Count > 0);
                this.rptFightGroups.DataSource  = fightGroups;
                this.rptFightGroups.DataBind();
                this.hdAppId.Value = base.site.WeixinAppId;
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareTitle))
                {
                    this.hdTitle.Value = (string.IsNullOrEmpty(productDetails.Title) ? productDetails.ProductName : productDetails.Title);
                }
                else
                {
                    this.hdTitle.Value = fightGroupActivitieInfo.ShareTitle.Trim();
                }
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareContent.Trim()))
                {
                    this.hdDesc.Value = productDetails.Meta_Description;
                }
                else
                {
                    this.hdDesc.Value = fightGroupActivitieInfo.ShareContent.Trim();
                }
                string local = string.IsNullOrEmpty(fightGroupActivitieInfo.Icon) ? SettingsManager.GetMasterSettings().DefaultProductImage : fightGroupActivitieInfo.Icon;
                this.hdImgUrl.Value = Globals.FullPath(local);
                this.hdLink.Value   = Globals.FullPath(this.Page.Request.Url.ToString());
                if (this.rptProductImages != null)
                {
                    string locationUrl = "javascript:;";
                    if (string.IsNullOrEmpty(productDetails.ImageUrl1) && string.IsNullOrEmpty(productDetails.ImageUrl2) && string.IsNullOrEmpty(productDetails.ImageUrl3) && string.IsNullOrEmpty(productDetails.ImageUrl4) && string.IsNullOrEmpty(productDetails.ImageUrl5))
                    {
                        productDetails.ImageUrl1 = masterSettings.DefaultProductImage;
                    }
                    DataTable         skus  = ProductBrowser.GetSkus(fightGroupActivitieInfo.ProductId);
                    List <SlideImage> list2 = new List <SlideImage>();
                    list2.Add(new SlideImage(productDetails.ImageUrl1, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl2, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl3, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl4, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl5, locationUrl));
                    this.rptProductImages.DataSource = from item in list2
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                    Literal control = this.litConsultationsCount;
                    num = ProductBrowser.GetProductConsultationsCount(productDetails.ProductId, false);
                    control.SetWhenIsNotNull(num.ToString());
                    if (this.litDescription != null)
                    {
                        string text  = "";
                        Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                        if (!string.IsNullOrWhiteSpace(productDetails.MobbileDescription))
                        {
                            text = regex.Replace(productDetails.MobbileDescription, "");
                        }
                        else if (!string.IsNullOrWhiteSpace(productDetails.Description))
                        {
                            text = regex.Replace(productDetails.Description, "");
                        }
                        text = text.Replace("src", "data-url");
                        this.litDescription.Text = text;
                    }
                    DataTable data = ProductBrowser.GetProductConsultations(new ProductConsultationAndReplyQuery
                    {
                        ProductId  = productDetails.ProductId,
                        PageIndex  = 1,
                        PageSize   = 2147483647,
                        SortOrder  = SortAction.Desc,
                        SortBy     = "ConsultationId",
                        HasReplied = true
                    }).Data;
                    for (int j = 0; j < data.Rows.Count; j++)
                    {
                        data.Rows[j]["UserName"] = DataHelper.GetHiddenUsername(data.Rows[j]["UserName"].ToNullString());
                    }
                    this.rptProductConsultations.DataSource = data;
                    this.rptProductConsultations.DataBind();
                    this.divConsultationEmpty.Visible = data.IsNullOrEmpty();
                }
            }
            else
            {
                base.GotoResourceNotFound("活动不存在");
            }
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OrderInfo    orderInfo      = null;
            PackageInfo  packageInfo    = new PackageInfo();
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            bool         flag           = this.Page.Request["IsOffline"].ToBool();
            string       a         = this.Page.Request["from"].ToNullString().ToLower();
            string       text      = this.Page.Request.QueryString.Get("orderId");
            string       empty     = string.Empty;
            string       empty2    = string.Empty;
            string       userAgent = base.Request.UserAgent;

            if (userAgent.ToLower().IndexOf("micromessenger") > -1)
            {
                this.isWeiXin = true;
            }
            if (a == "appstore")
            {
                this.isOfflineOrder = "true";
                if (string.IsNullOrEmpty(text))
                {
                    this.Page.Response.Write("<h2 style=\"color:red;width:100%; text-align:center;\">错误的订单号,不能进行支付!<h2>");
                    this.Page.Response.End();
                }
                empty = text;
                decimal             d = default(decimal);
                StoreCollectionInfo storeCollectionInfo = null;
                if (flag)
                {
                    this.isOfflineOrder = "true";
                    storeCollectionInfo = StoresHelper.GetStoreCollectionInfo(text);
                    if (storeCollectionInfo == null)
                    {
                        this.Page.Response.Write("<h2 style=\"color:red;width:100%; text-align:center;\">订单状态错误,不能进行支付!<h2>");
                        this.Page.Response.End();
                    }
                    if (storeCollectionInfo.Status != 0)
                    {
                        this.Page.Response.Write("<h2 style=\"color:red;width:100%; text-align:center;\">订单状态错误,不能进行支付!<h2>");
                        this.Page.Response.End();
                    }
                    d = storeCollectionInfo.PayAmount;
                }
                else
                {
                    orderInfo = ShoppingProcessor.GetOrderInfo(text);
                    if (orderInfo == null)
                    {
                        this.Page.Response.Write("<h2 style=\"color:red;width:100%; text-align:center;\">订单状态错误,不能进行支付!<h2>");
                        this.Page.Response.End();
                    }
                    if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
                    {
                        this.Page.Response.Write("<h2 style=\"color:red;width:100%; text-align:center;\">订单状态错误,不能进行支付!<h2>");
                        this.Page.Response.End();
                    }
                    this.IsServiceOrder = ((orderInfo.OrderType == OrderType.ServiceOrder) ? "true" : "false");
                    if (orderInfo.PreSaleId > 0)
                    {
                        if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                        {
                            empty = orderInfo.OrderId;
                            d     = orderInfo.Deposit - orderInfo.BalanceAmount;
                        }
                        if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                        {
                            if (orderInfo.PayRandCode.ToInt(0) == 0)
                            {
                                int num = orderInfo.PayRandCode.ToInt(0);
                                num = ((num >= 100) ? (num + 1) : 100);
                                orderInfo.PayRandCode = num.ToString();
                                OrderHelper.UpdateOrderPaymentTypeOfAPI(orderInfo);
                            }
                            empty = orderInfo.PayOrderId;
                            d     = orderInfo.FinalPayment;
                        }
                    }
                    else
                    {
                        empty = orderInfo.PayOrderId;
                        d     = orderInfo.GetTotal(true);
                    }
                }
                packageInfo.Body       = text;
                packageInfo.NotifyUrl  = Globals.GetProtocal(HttpContext.Current) + "://" + $"{this.Page.Request.Url.Host}/pay/AppStore_wxPay";
                packageInfo.OutTradeNo = empty;
                packageInfo.TotalFee   = (int)(d * 100m);
                if (orderInfo != null)
                {
                    packageInfo.OutTradeNo = orderInfo.PayOrderId;
                    packageInfo.Attach     = empty2;
                }
                else
                {
                    packageInfo.OutTradeNo = empty;
                    packageInfo.Attach     = empty2;
                }
                if (packageInfo.TotalFee < decimal.One)
                {
                    packageInfo.TotalFee = decimal.One;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(text))
                {
                    this.Page.Response.Write("<h2 style=\"color:red;width:100%; text-align:center;\">订单状态错误,不能进行支付!<h2>");
                    this.Page.Response.End();
                }
                orderInfo = OrderHelper.GetOrderInfo(text);
                if (orderInfo == null)
                {
                    this.Page.Response.Write("<h2 style=\"color:red;width:100%; text-align:center;\">订单状态错误,不能进行支付!<h2>");
                    this.Page.Response.End();
                }
                if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
                {
                    this.Page.Response.Write("<h2 style=\"color:red;width:100%; text-align:center;\">订单状态错误,不能进行支付!<h2>");
                    this.Page.Response.End();
                }
                this.IsServiceOrder = ((orderInfo.OrderType == OrderType.ServiceOrder) ? "true" : "false");
                empty             = text;
                this.isFightGroup = ((orderInfo.FightGroupId > 0) ? "true" : "false");
                decimal d2 = default(decimal);
                if (orderInfo.PreSaleId > 0)
                {
                    if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        empty = orderInfo.OrderId;
                        d2    = ((orderInfo.Deposit - orderInfo.BalanceAmount > decimal.Zero) ? (orderInfo.Deposit - orderInfo.BalanceAmount) : decimal.Zero);
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (orderInfo.PayRandCode.ToInt(0) == 0)
                        {
                            int num2 = orderInfo.PayRandCode.ToInt(0);
                            num2 = ((num2 >= 100) ? (num2 + 1) : 100);
                            orderInfo.PayRandCode = num2.ToString();
                            OrderHelper.UpdateOrderPaymentTypeOfAPI(orderInfo);
                        }
                        empty = orderInfo.PayOrderId;
                        d2    = ((orderInfo.FinalPayment > decimal.Zero) ? orderInfo.FinalPayment : decimal.Zero);
                    }
                }
                else
                {
                    empty = orderInfo.OrderId;
                    d2    = orderInfo.GetTotal(true);
                }
                packageInfo.Body      = orderInfo.OrderId + orderInfo.PayRandCode;
                packageInfo.NotifyUrl = Globals.GetProtocal(HttpContext.Current) + "://" + $"{this.Page.Request.Url.Host}/pay/wx_Pay";
                if (orderInfo.OrderType != OrderType.ServiceOrder && orderInfo.OrderSource == OrderSource.Applet)
                {
                    packageInfo.NotifyUrl = Globals.GetProtocal(HttpContext.Current) + "://" + $"{this.Page.Request.Url.Host}/pay/O2OApplet_Pay";
                }
                packageInfo.OutTradeNo = orderInfo.PayOrderId;
                packageInfo.Attach     = empty2;
                packageInfo.TotalFee   = (int)(d2 * 100m);
                if (packageInfo.TotalFee < decimal.One)
                {
                    packageInfo.TotalFee = decimal.One;
                }
            }
            string text2     = masterSettings.WeixinAppId;
            string appSecret = masterSettings.WeixinAppSecret;
            string text3     = masterSettings.WeixinPartnerID;
            string text4     = masterSettings.WeixinPartnerKey;
            string text5     = masterSettings.Main_Mch_ID;
            string text6     = masterSettings.Main_AppId;

            if (a != "appstore")
            {
                if (orderInfo.OrderType == OrderType.ServiceOrder && orderInfo.OrderSource != OrderSource.WeiXin)
                {
                    text2     = masterSettings.O2OAppletAppId;
                    appSecret = masterSettings.O2OAppletAppSecrect;
                    text3     = masterSettings.O2OAppletMchId;
                    text4     = masterSettings.O2OAppletKey;
                    text5     = "";
                    text6     = "";
                }
                else if (orderInfo.OrderSource == OrderSource.Applet)
                {
                    text2     = masterSettings.WxAppletAppId;
                    appSecret = masterSettings.WxAppletAppSecrect;
                    text3     = masterSettings.WxApplectMchId;
                    text4     = masterSettings.WxApplectKey;
                    text5     = "";
                    text6     = "";
                }
            }
            string     text7 = "";
            MemberInfo user  = HiContext.Current.User;

            if (user.UserId > 0 && a != "appstore")
            {
                MemberOpenIdInfo memberOpenIdInfo = null;
                if (orderInfo.OrderType == OrderType.ServiceOrder && orderInfo.OrderSource != OrderSource.WeiXin)
                {
                    memberOpenIdInfo = user.MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.o2owxapplet");
                    if (memberOpenIdInfo != null)
                    {
                        text7 = memberOpenIdInfo.OpenId;
                    }
                }
                else if (orderInfo.OrderSource == OrderSource.Applet)
                {
                    memberOpenIdInfo = user.MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.wxapplet");
                    if (memberOpenIdInfo != null)
                    {
                        text7 = memberOpenIdInfo.OpenId;
                    }
                }
                else
                {
                    memberOpenIdInfo = user.MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin");
                    if (memberOpenIdInfo != null && user.IsDefaultDevice)
                    {
                        text7 = memberOpenIdInfo.OpenId;
                    }
                }
            }
            if (string.IsNullOrEmpty(text7))
            {
                PayConfig payConfig = new PayConfig();
                payConfig.AppId     = text2;
                payConfig.Key       = text4;
                payConfig.MchID     = text3;
                payConfig.AppSecret = appSecret;
                JsApiPay jsApiPay = new JsApiPay();
                try
                {
                    NameValueCollection openidAndAccessToken = JsApiPay.GetOpenidAndAccessToken(this.Page, payConfig.AppId, payConfig.AppSecret, false);
                    if (openidAndAccessToken.HasKeys())
                    {
                        text7 = openidAndAccessToken["openId"];
                    }
                }
                catch (Exception ex)
                {
                    if (!(ex is ThreadAbortException))
                    {
                        IDictionary <string, string> dictionary = new Dictionary <string, string>();
                        dictionary.Add("AppId", payConfig.AppId);
                        dictionary.Add("Key", payConfig.Key);
                        dictionary.Add("MchID", payConfig.MchID);
                        dictionary.Add("AppSecret", payConfig.AppSecret);
                        dictionary.Add("Exception", ex.Message);
                        dictionary.Add("StackTrace", ex.StackTrace);
                        dictionary.Add("TargetSite", ex.TargetSite.ToString());
                        Globals.WriteLog(dictionary, "获取用户OpenId失败", "", "", "GetOpenId");
                    }
                }
            }
            if (!string.IsNullOrEmpty(text6) && !string.IsNullOrEmpty(text5))
            {
                packageInfo.sub_openid = text7;
            }
            else
            {
                packageInfo.OpenId = text7;
            }
            PayClient payClient = null;

            payClient = ((string.IsNullOrEmpty(text6) || string.IsNullOrEmpty(text5)) ? new PayClient(text2, appSecret, text3, text4, "", "", "", "") : new PayClient(text6, appSecret, text5, text4, "", text3, text2, ""));
            PayRequestInfo req = payClient.BuildPayRequest(packageInfo);

            this.pay_json = this.ConvertPayJson(req);
            this.pay_uri  = this.ConvertPayUri(req);
            if (!this.isWeiXin)
            {
                base.Response.Redirect(this.pay_uri);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Response.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\"/>");
            NameValueCollection nameValueCollection = new NameValueCollection
            {
                this.Page.Request.Form,
                this.Page.Request.QueryString
            };

            nameValueCollection.Add("IsReturn", "true");
            this.Gateway      = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            this.Notify       = PaymentNotify.CreateInstance(this.Gateway, nameValueCollection);
            this.OrderId      = this.Notify.GetOrderId();
            this.Order        = ShoppingProcessor.GetOrderInfo(this.OrderId);
            this.offlineOrder = StoresHelper.GetStoreCollectionInfo(this.OrderId);
            if (this.Order == null && this.offlineOrder == null)
            {
                base.Response.Write("success");
            }
            else
            {
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");
                if (paymentMode == null)
                {
                    Globals.WriteLog(nameValueCollection, "支付方式获取失败hishop.plugins.payment.ws_wappay.wswappayrequest", "", "", "alipay");
                    base.Response.Write("success");
                }
                else
                {
                    this.Amount = this.Notify.GetOrderAmount();
                    if (this.Order == null)
                    {
                        this.isOfflineOrder = true;
                    }
                    else
                    {
                        if (this.Amount <= decimal.Zero)
                        {
                            this.Amount = this.Order.GetTotal(true);
                        }
                        this.offlineOrder         = StoresHelper.GetStoreCollectionInfoOfOrderId(this.OrderId);
                        this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId();
                        this.Order.PaymentType    = paymentMode.Name;
                        this.Order.PaymentTypeId  = paymentMode.ModeId;
                        this.Order.Gateway        = paymentMode.Gateway;
                        if (this.offlineOrder == null)
                        {
                            this.offlineOrder = StoresHelper.GetStoreCollectionInfoOfOrderId(this.Order.OrderId);
                        }
                    }
                    if (this.offlineOrder != null)
                    {
                        if (this.Amount <= decimal.Zero)
                        {
                            this.Amount = this.offlineOrder.PayAmount;
                        }
                        this.offlineOrder.GateWayOrderId  = this.Notify.GetGatewayOrderId();
                        this.offlineOrder.PaymentTypeId   = paymentMode.ModeId;
                        this.offlineOrder.PaymentTypeName = paymentMode.Name;
                        this.offlineOrder.GateWay         = paymentMode.Gateway;
                    }
                    this.Notify.Finished          += this.Notify_Finished;
                    this.Notify.NotifyVerifyFaild += this.Notify_NotifyVerifyFaild;
                    this.Notify.Payment           += this.Notify_Payment;
                    this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(paymentMode.Settings));
                }
            }
        }
        public static void OnLineBalanceDrawRequest_API(int Id, bool IsSuccess, string sError)
        {
            bool                        flag                        = false;
            StoreBalanceDao             storeBalanceDao             = new StoreBalanceDao();
            StoreBalanceDrawRequestInfo storeBalanceDrawRequestInfo = storeBalanceDao.Get <StoreBalanceDrawRequestInfo>(Id);

            if (storeBalanceDrawRequestInfo != null)
            {
                StoresInfo  storeById = StoresHelper.GetStoreById(storeBalanceDrawRequestInfo.StoreId);
                ManagerInfo manager   = HiContext.Current.Manager;
                string      text      = (manager == null) ? "" : manager.UserName;
                Database    database  = DatabaseFactory.CreateDatabase();
                using (DbConnection dbConnection = database.CreateConnection())
                {
                    dbConnection.Open();
                    DbTransaction dbTransaction = dbConnection.BeginTransaction();
                    try
                    {
                        OnLinePayment onLinePayment;
                        if (storeById == null)
                        {
                            if (IsSuccess)
                            {
                                flag = storeBalanceDao.DeleteBalanceDrawRequestById(true, storeById.Balance, storeBalanceDrawRequestInfo, text, dbTransaction, "");
                            }
                            else
                            {
                                StoreBalanceDao storeBalanceDao2 = storeBalanceDao;
                                onLinePayment = OnLinePayment.PayFail;
                                flag          = storeBalanceDao2.UpdateBalanceDrawRequest(Id, onLinePayment.GetHashCode().ToNullString(), "未找到该门店,请拒绝该请求或做线下处理", text);
                            }
                            if (!flag)
                            {
                                dbTransaction.Rollback();
                            }
                            else
                            {
                                dbTransaction.Commit();
                            }
                        }
                        else
                        {
                            if (IsSuccess)
                            {
                                flag = storeBalanceDao.DeleteBalanceDrawRequestById(true, storeById.Balance, storeBalanceDrawRequestInfo, text, dbTransaction, "");
                                if (!flag)
                                {
                                    dbTransaction.Rollback();
                                    goto end_IL_006f;
                                }
                            }
                            else
                            {
                                StoreBalanceDao storeBalanceDao3 = storeBalanceDao;
                                onLinePayment = OnLinePayment.PayFail;
                                flag          = storeBalanceDao3.UpdateBalanceDrawRequest(Id, onLinePayment.GetHashCode().ToNullString(), sError, text);
                            }
                            if (!flag)
                            {
                                dbTransaction.Rollback();
                            }
                            else
                            {
                                string text2 = "";
                                text2 = ((!storeBalanceDrawRequestInfo.IsAlipay.HasValue || !storeBalanceDrawRequestInfo.IsAlipay.Value) ? ("银行卡:" + storeBalanceDrawRequestInfo.BankName + "(" + storeBalanceDrawRequestInfo.AccountName + ")") : ("支付宝:" + storeBalanceDrawRequestInfo.AlipayCode));
                                Messenger.DrawResultMessager(null, storeById, storeBalanceDrawRequestInfo.Amount, text2, storeBalanceDrawRequestInfo.RequestTime, false, sError);
                                dbTransaction.Commit();
                            }
                        }
                        end_IL_006f :;
                    }
                    catch (Exception ex)
                    {
                        IDictionary <string, string> dictionary = new Dictionary <string, string>();
                        dictionary.Add("ErrorMessage", ex.Message);
                        dictionary.Add("StackTrace", ex.StackTrace);
                        if (ex.InnerException != null)
                        {
                            dictionary.Add("InnerException", ex.InnerException.ToString());
                        }
                        if (ex.GetBaseException() != null)
                        {
                            dictionary.Add("BaseException", ex.GetBaseException().Message);
                        }
                        if (ex.TargetSite != (MethodBase)null)
                        {
                            dictionary.Add("TargetSite", ex.TargetSite.ToString());
                        }
                        dictionary.Add("ExSource", ex.Source);
                        Globals.WriteLog(dictionary, "", "", "", "AcceptDraw");
                        dbTransaction.Rollback();
                    }
                    finally
                    {
                        dbConnection.Close();
                    }
                }
            }
        }
        public static bool DealBalanceDrawRequestById(int Id, bool agree, ref string sError, string reason = "")
        {
            bool                        flag                        = false;
            StoreBalanceDao             storeBalanceDao             = new StoreBalanceDao();
            StoreBalanceDrawRequestInfo storeBalanceDrawRequestInfo = storeBalanceDao.Get <StoreBalanceDrawRequestInfo>(Id);

            if (storeBalanceDrawRequestInfo == null)
            {
                return(false);
            }
            StoresInfo  storeById = StoresHelper.GetStoreById(storeBalanceDrawRequestInfo.StoreId);
            ManagerInfo manager   = HiContext.Current.Manager;
            string      text      = (manager == null) ? "" : manager.UserName;
            Database    database  = DatabaseFactory.CreateDatabase();

            using (DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    if (agree)
                    {
                        if (storeBalanceDrawRequestInfo.IsPass.HasValue)
                        {
                            sError = "已处理该条记录";
                            dbTransaction.Rollback();
                            return(false);
                        }
                        OnLinePayment onLinePayment;
                        if (storeById == null)
                        {
                            sError = "未找到该门店";
                            StoreBalanceDao storeBalanceDao2 = storeBalanceDao;
                            onLinePayment = OnLinePayment.PayFail;
                            flag          = storeBalanceDao2.UpdateBalanceDrawRequest(Id, onLinePayment.GetHashCode().ToNullString(), "未找到该门店,请拒绝该用户的请求", text);
                            if (!flag)
                            {
                                dbTransaction.Rollback();
                                return(false);
                            }
                            dbTransaction.Commit();
                            return(false);
                        }
                        string text2 = storeBalanceDrawRequestInfo.RequestState.ToNullString().Trim();
                        onLinePayment = OnLinePayment.Paying;
                        if (text2.Equals(onLinePayment.GetHashCode().ToNullString()))
                        {
                            sError = "付款正在进行中";
                            dbTransaction.Rollback();
                            return(false);
                        }
                        if (storeBalanceDrawRequestInfo.IsAlipay.ToBool())
                        {
                            StoreBalanceDao storeBalanceDao3 = storeBalanceDao;
                            onLinePayment = OnLinePayment.Paying;
                            flag          = storeBalanceDao3.UpdateBalanceDrawRequest(Id, onLinePayment.GetHashCode().ToNullString(), "", text);
                            if (!flag)
                            {
                                dbTransaction.Rollback();
                                return(false);
                            }
                            EventLogs.WriteOperationLog(Privilege.MemberAccount, string.Format(CultureInfo.InvariantCulture, "给门店\"{0}\"处理提现申请(支付宝批量付款)", new object[1]
                            {
                                storeById.StoreName
                            }), false);
                            return(true);
                        }
                        flag = storeBalanceDao.DeleteBalanceDrawRequestById(agree, storeById.Balance, storeBalanceDrawRequestInfo, text, dbTransaction, reason);
                        if (!flag)
                        {
                            dbTransaction.Rollback();
                            return(false);
                        }
                        string text3 = "";
                        text3 = ((!storeBalanceDrawRequestInfo.IsAlipay.HasValue || !storeBalanceDrawRequestInfo.IsAlipay.Value) ? ("银行卡:" + storeBalanceDrawRequestInfo.BankName + "(" + storeBalanceDrawRequestInfo.AccountName + ")") : ("支付宝:" + storeBalanceDrawRequestInfo.AlipayCode));
                        Messenger.DrawResultMessager(null, storeById, storeBalanceDrawRequestInfo.Amount, text3, storeBalanceDrawRequestInfo.RequestTime, true, "");
                    }
                    else
                    {
                        flag = storeBalanceDao.DeleteBalanceDrawRequestById(agree, storeById.Balance, storeBalanceDrawRequestInfo, text, dbTransaction, reason);
                        if (!flag)
                        {
                            dbTransaction.Rollback();
                            return(false);
                        }
                        string text4 = "";
                        text4 = ((!storeBalanceDrawRequestInfo.IsAlipay.HasValue || !storeBalanceDrawRequestInfo.IsAlipay.Value) ? ("银行卡:" + storeBalanceDrawRequestInfo.BankName + "(" + storeBalanceDrawRequestInfo.AccountName + ")") : ("支付宝:" + storeBalanceDrawRequestInfo.AlipayCode));
                        Messenger.DrawResultMessager(null, storeById, storeBalanceDrawRequestInfo.Amount, text4, storeBalanceDrawRequestInfo.RequestTime, false, reason);
                    }
                    dbTransaction.Commit();
                    EventLogs.WriteOperationLog(Privilege.MemberAccount, string.Format(CultureInfo.InvariantCulture, "给门店\"{0}\"处理提现申请", new object[1]
                    {
                        storeById.StoreName
                    }), false);
                }
                catch (Exception ex)
                {
                    IDictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary.Add("ErrorMessage", ex.Message);
                    dictionary.Add("StackTrace", ex.StackTrace);
                    if (ex.InnerException != null)
                    {
                        dictionary.Add("InnerException", ex.InnerException.ToString());
                    }
                    if (ex.GetBaseException() != null)
                    {
                        dictionary.Add("BaseException", ex.GetBaseException().Message);
                    }
                    if (ex.TargetSite != (MethodBase)null)
                    {
                        dictionary.Add("TargetSite", ex.TargetSite.ToString());
                    }
                    dictionary.Add("ExSource", ex.Source);
                    Globals.WriteLog(dictionary, "", "", "", "AcceptDraw");
                    sError = ex.Message;
                    dbTransaction.Rollback();
                }
                finally
                {
                    dbConnection.Close();
                }
                return(flag);
            }
        }
        public void bindReturnInfo()
        {
            int        returnId   = this.Page.Request["ReturnId"].ToInt(0);
            ReturnInfo returnInfo = TradeHelper.GetReturnInfo(returnId);

            if (returnInfo == null)
            {
                this.ShowMsg("退货信息错误!", false);
                return;
            }
            HiddenField hiddenField = this.hidReturnStatus;
            int         num         = (int)returnInfo.HandleStatus;

            hiddenField.Value = num.ToString();
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(returnInfo.OrderId);

            if (orderInfo == null)
            {
                this.ShowMsg("错误的订单信息!", false);
                return;
            }
            if (orderInfo.StoreId != this.UserStoreId)
            {
                this.ShowMsg("不是门店的订单不能进行处理", false);
                return;
            }
            if (string.IsNullOrEmpty(returnInfo.SkuId))
            {
                this.listPrducts.DataSource = orderInfo.LineItems.Values;
            }
            else
            {
                Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>();
                foreach (LineItemInfo value in orderInfo.LineItems.Values)
                {
                    if (value.SkuId == returnInfo.SkuId)
                    {
                        dictionary.Add(value.SkuId, value);
                    }
                }
                this.listPrducts.DataSource = dictionary.Values;
            }
            this.listPrducts.DataBind();
            this.litOrderId.Text      = orderInfo.PayOrderId;
            this.litOrderTotal.Text   = orderInfo.GetTotal(false).F2ToString("f2");
            this.litRefundReason.Text = returnInfo.ReturnReason;
            this.litRefundTotal.Text  = returnInfo.RefundAmount.F2ToString("f2");
            this.litRemark.Text       = returnInfo.UserRemark;
            Literal literal = this.litReturnQuantity;

            num          = returnInfo.Quantity;
            literal.Text = num.ToString();
            if (returnInfo.RefundType == RefundTypes.InBankCard)
            {
                this.litType.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.RefundType, 0) + "(" + returnInfo.BankName + "  " + returnInfo.BankAccountName + "  " + returnInfo.BankAccountNo + ")";
            }
            else
            {
                this.litType.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.RefundType, 0);
            }
            string userCredentials = returnInfo.UserCredentials;

            if (!string.IsNullOrEmpty(userCredentials))
            {
                string[] array = userCredentials.Split('|');
                userCredentials = "";
                string[] array2 = array;
                foreach (string str in array2)
                {
                    userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str);
                }
                this.litImageList.Text = userCredentials;
            }
            else
            {
                this.divCredentials.Visible = false;
            }
            if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
            {
                this.btnAcceptReturn.Text = "确认退款";
                this.btnRefuseReturn.Text = "拒绝退款";
                this.AfterSaleType        = "退款";
            }
            if (returnInfo.HandleStatus == ReturnStatus.Applied && orderInfo.StoreId == this.UserStoreId && (returnInfo.AfterSaleType != AfterSaleTypes.OnlyRefund || (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund && orderInfo.IsStoreCollect)))
            {
                this.btnAcceptReturn.Visible = true;
                this.btnRefuseReturn.Visible = true;
            }
            if (returnInfo.HandleStatus == ReturnStatus.Deliverying && this.UserStoreId == orderInfo.StoreId && !orderInfo.IsStoreCollect && returnInfo.RefundType != RefundTypes.InBalance)
            {
                this.btnGetGoods.Visible = true;
            }
            int num2;

            if ((orderInfo.IsStoreCollect || returnInfo.RefundType == RefundTypes.InBalance) && orderInfo.StoreId == this.UserStoreId)
            {
                num2 = ((returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Deliverying) ? 1 : 0);
                goto IL_0439;
            }
            num2 = 0;
            goto IL_0439;
IL_0439:
            if (num2 != 0)
            {
                if (returnInfo.HandleStatus == ReturnStatus.Deliverying)
                {
                    this.btnFinishReturn.Text = "确认收货并完成退款";
                }
                this.btnFinishReturn.Visible = true;
            }
            if (returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned)
            {
                this.inputPanel.Visible = true;
                this.showPanel.Visible  = false;
            }
            else
            {
                this.inputPanel.Visible = false;
                this.showPanel.Visible  = true;
            }
            if (returnInfo.HandleStatus != 0)
            {
                this.txtAdminCellPhone.Visible   = false;
                this.txtAdminShipAddress.Visible = false;
                this.txtAdminShipTo.Visible      = false;
                this.litAdminCellPhone.Visible   = true;
                this.litAdminShipAddrss.Visible  = true;
                this.litAdminShipTo.Visible      = true;
                this.litAdminCellPhone.Text      = returnInfo.AdminCellPhone;
                this.litAdminShipTo.Text         = returnInfo.AdminShipTo;
                this.litAdminShipAddrss.Text     = returnInfo.AdminShipAddress;
            }
            else
            {
                StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId);
                if (storeById != null)
                {
                    Literal literal2 = this.litAdminShipAddrss;
                    TextBox textBox  = this.txtAdminShipAddress;
                    string  text3    = literal2.Text = (textBox.Text = RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address);
                    Literal literal3 = this.litAdminShipTo;
                    TextBox textBox2 = this.txtAdminShipTo;
                    text3 = (literal3.Text = (textBox2.Text = storeById.ContactMan));
                    Literal literal4 = this.litAdminCellPhone;
                    TextBox textBox3 = this.txtAdminCellPhone;
                    text3 = (literal4.Text = (textBox3.Text = storeById.Tel));
                }
            }
            this.txtAdminRemark.Text = returnInfo.AdminRemark;
            if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
            {
                this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 3);
            }
            else
            {
                this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 0);
            }
            this.litRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2") + "元";
            Literal literal5 = this.txtAfterSaleId;

            num                      = returnInfo.ReturnId;
            literal5.Text            = num.ToString();
            this.txtPayMoney.Text    = orderInfo.GetTotal(false).F2ToString("f2");
            this.txtRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2");
            HiddenField hiddenField2 = this.hidAfterSaleType;

            num = (int)returnInfo.AfterSaleType;
            hiddenField2.Value            = num.ToString();
            this.hidRefundMaxAmount.Value = orderInfo.GetCanRefundAmount(returnInfo.SkuId, null, 0).F2ToString("f2");
            if (returnInfo.AfterSaleType == AfterSaleTypes.ReturnAndRefund && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned))
            {
                this.btnViewLogistic.Visible = true;
                AttributeCollection attributes = this.btnViewLogistic.Attributes;
                num = returnInfo.ReturnId;
                attributes.Add("returnsid", num.ToString());
                this.btnViewLogistic.Attributes.Add("expresscompanyname", returnInfo.ExpressCompanyName.ToString());
                this.btnViewLogistic.Attributes.Add("shipordernumber", returnInfo.ShipOrderNumber.ToString());
            }
        }
        protected override void AttachChildControls()
        {
            string orderId = this.Page.Request.QueryString["orderId"];

            this.LogisticsInfo = (HtmlGenericControl)this.FindControl("LogisticsInfoPanel");
            Literal literal = this.FindControl("litLogisiticType") as Literal;

            this.hylExpress100Search = (HyperLink)this.FindControl("hylExpress100Search");
            this.ulExpress           = (HtmlGenericControl)this.FindControl("ulExpress");
            int num = 0;

            int.TryParse(this.Page.Request.QueryString["returnsId"], out num);
            int num2 = 0;

            int.TryParse(this.Page.Request.QueryString["replaceId"], out num2);
            string          text            = "";
            string          text2           = "";
            string          text3           = "";
            string          text4           = "";
            string          text5           = "";
            string          text6           = "";
            bool            flag            = false;
            HtmlInputHidden htmlInputHidden = this.FindControl("hidReplaceType") as HtmlInputHidden;
            OrderInfo       orderInfo       = ShoppingProcessor.GetOrderInfo(orderId);

            if (orderInfo == null || orderInfo.UserId != HiContext.Current.UserId)
            {
                if (num > 0)
                {
                    ReturnInfo returnInfo = TradeHelper.GetReturnInfo(num);
                    if (returnInfo != null && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned))
                    {
                        text  = returnInfo.ExpressCompanyName;
                        text2 = returnInfo.ShipOrderNumber;
                        text3 = returnInfo.AdminShipTo;
                        text4 = returnInfo.AdminCellPhone;
                        text5 = returnInfo.AdminShipAddress;
                        text6 = returnInfo.ExpressCompanyAbb;
                        flag  = true;
                    }
                }
                if (num2 > 0)
                {
                    ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(num2);
                    orderInfo = ShoppingProcessor.GetOrderInfo(replaceInfo.OrderId);
                    if (orderInfo == null)
                    {
                        this.LogisticsInfo.InnerHtml = "订单不存在或已被删除";
                        return;
                    }
                    if (replaceInfo != null)
                    {
                        if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery)
                        {
                            htmlInputHidden.Value = "User";
                            text  = replaceInfo.UserExpressCompanyName;
                            text2 = replaceInfo.UserShipOrderNumber;
                            text3 = replaceInfo.AdminShipTo;
                            text4 = replaceInfo.AdminCellPhone;
                            text5 = replaceInfo.AdminShipAddress;
                            text6 = replaceInfo.ExpressCompanyAbb;
                            flag  = true;
                        }
                        if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced)
                        {
                            htmlInputHidden.Value = "Mall";
                            text  = replaceInfo.ExpressCompanyName;
                            text2 = replaceInfo.ShipOrderNumber;
                            text3 = orderInfo.ShipTo;
                            text4 = (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone);
                            text5 = orderInfo.ShippingRegion + "   " + orderInfo.Address;
                            text6 = orderInfo.ExpressCompanyAbb;
                        }
                        else
                        {
                            this.LogisticsInfo.InnerHtml = "商家还未发货";
                        }
                    }
                }
            }
            else
            {
                flag  = true;
                text  = orderInfo.ExpressCompanyName;
                text2 = orderInfo.ShipOrderNumber;
                text3 = orderInfo.ShipTo;
                text4 = (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone);
                text5 = orderInfo.ShippingRegion + "   " + orderInfo.Address;
                text6 = orderInfo.ExpressCompanyAbb;
            }
            if (!flag)
            {
                base.GotoResourceNotFound("错误的物流数据");
            }
            Literal         literal2         = this.FindControl("ltlExpressCompanyName") as Literal;
            Literal         literal3         = this.FindControl("ltlShipOrderNumber") as Literal;
            Literal         literal4         = this.FindControl("ltlReceiveName") as Literal;
            Literal         literal5         = this.FindControl("ltlTel") as Literal;
            Literal         literal6         = this.FindControl("ltlShipAddress") as Literal;
            Literal         literal7         = this.FindControl("Repeater") as Literal;
            HtmlInputHidden htmlInputHidden2 = this.FindControl("hidOrderId") as HtmlInputHidden;

            htmlInputHidden2.Value = ((orderInfo != null) ? orderInfo.OrderId : string.Empty);
            HtmlInputHidden htmlInputHidden3 = this.FindControl("hidIsShowDadaGIS") as HtmlInputHidden;
            HtmlInputHidden htmlInputHidden4 = this.FindControl("hidUserLatlng") as HtmlInputHidden;
            HtmlInputHidden htmlInputHidden5 = this.FindControl("hidStoreLatlng") as HtmlInputHidden;
            HtmlInputHidden htmlInputHidden6 = this.FindControl("hidBaseURL") as HtmlInputHidden;

            htmlInputHidden6.Value = Globals.HostPath(this.Page.Request.Url);
            if (orderInfo != null)
            {
                if (orderInfo.ExpressCompanyName.ToNullString() == "同城物流配送")
                {
                    htmlInputHidden3.Value = "1";
                }
                if (orderInfo.ShippingId > 0)
                {
                    ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId);
                    if (shippingAddress != null && !string.IsNullOrWhiteSpace(shippingAddress.LatLng))
                    {
                        htmlInputHidden4.Value = shippingAddress.LatLng;
                    }
                }
                if (orderInfo.StoreId > 0)
                {
                    StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId);
                    if (storeById != null && !string.IsNullOrWhiteSpace(storeById.LatLng))
                    {
                        htmlInputHidden5.Value = storeById.LatLng;
                    }
                }
                else
                {
                    ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0);
                    if (defaultOrFirstShipper != null)
                    {
                        htmlInputHidden5.Value = defaultOrFirstShipper.Latitude + "," + defaultOrFirstShipper.Longitude;
                    }
                }
            }
            literal2.Text = text;
            literal3.Text = text2;
            if (!string.IsNullOrEmpty(text2))
            {
                string text7 = HttpContext.Current.Request.Url.ToString().ToLower();
                if (text7.IndexOf("/wapshop/") != -1)
                {
                    if (text6.ToLower() == "sf")
                    {
                        this.hylExpress100Search.NavigateUrl = $"http://www.sf-express.com/mobile/cn/sc/dynamic_function/waybill/waybill_query_info.html?billno={text2}";
                        this.hylExpress100Search.Text        = "顺丰官网查询>";
                    }
                    else
                    {
                        this.hylExpress100Search.NavigateUrl = $"https://m.kuaidi100.com/result.jsp?nu={text2}";
                    }
                }
                else if (text6.ToLower() == "sf")
                {
                    this.hylExpress100Search.NavigateUrl = $"http://www.sf-express.com/mobile/cn/sc/dynamic_function/waybill/waybill_query_info.html?billno={text2}";
                    this.hylExpress100Search.Text        = "顺丰官网查询>";
                }
                else
                {
                    this.hylExpress100Search.NavigateUrl = $"https://www.kuaidi100.com/chaxun?nu={text2}";
                }
            }
            else
            {
                this.ulExpress.Visible = false;
            }
            literal4.Text = text3;
            literal5.Text = text4;
            literal6.Text = text5;
            PageTitle.AddSiteNameTitle("查看物流");
        }
 protected override void AttachChildControls()
 {
     this.inputPaymentModeId      = (HtmlInputHidden)this.FindControl("inputPaymentModeId");
     this.inputShippingModeId     = (HtmlInputHidden)this.FindControl("inputShippingModeId");
     this.hidPaymentId_Podrequest = (HtmlInputHidden)this.FindControl("hidPaymentId_Podrequest");
     this.hidPaymentId_Offline    = (HtmlInputHidden)this.FindControl("hidPaymentId_Offline");
     this.hidGetgoodsOnStores     = (HtmlInputHidden)this.FindControl("hidGetgoodsOnStores");
     this.hidHasStoresInCity      = (HtmlInputHidden)this.FindControl("hidHasStoresInCity");
     this.hidDeliveryTime         = (HtmlInputHidden)this.FindControl("hidDeliveryTime");
     this.hidStoreId            = (HtmlInputHidden)this.FindControl("hidStoreId");
     this.hidShipAddressId      = (HtmlInputHidden)this.FindControl("hidShipAddressId");
     this.litStoreName          = (Literal)this.FindControl("litStoreName");
     this.litAddress            = (Literal)this.FindControl("litAddress");
     this.litTel                = (Literal)this.FindControl("litTel");
     this.hidOnlinePayCount     = (HtmlInputHidden)this.FindControl("hidOnlinePayCount");
     this.hidHasSupplierProduct = (HtmlInputHidden)this.FindControl("hidHasSupplierProduct");
     if (!this.Page.IsPostBack)
     {
         this.hidHasSupplierProduct.Value   = this.hasSupplierProduct.ToString();
         this.hidOnlinePayCount.Value       = TradeHelper.WapPaymentTypeCount(ClientType.App, this.isFightGroup).ToNullString();
         this.hidGetgoodsOnStores.Value     = "false";
         this.hidHasStoresInCity.Value      = "false";
         this.hidPaymentId_Podrequest.Value = "0";
         int num  = 0;
         int num2 = 0;
         if (this.from != "countdown" && this.from != "groupbuy" && this.hasSupplierProduct != 1)
         {
             if (this.from != "presale" && SalesHelper.IsSupportPodrequest())
             {
                 num = 1;
                 this.hidPaymentId_Podrequest.Value = "1";
             }
             if (ShoppingProcessor.IsSupportOfflineRequest())
             {
                 this.hidPaymentId_Offline.Value = "2";
                 num2 = 2;
             }
         }
         if (this.paymentModeId != 0 && this.paymentModeId != num && this.paymentModeId != num2 && this.paymentModeId != -3)
         {
             this.paymentModeId = 0;
         }
         this.hidDeliveryTime.Value = this.deliveryTime;
         if (this.paymentModeId == 0)
         {
             if (TradeHelper.WapPaymentTypeCount(ClientType.App, this.isFightGroup) > 0)
             {
                 this.inputPaymentModeId.Value = this.paymentModeId.ToString();
             }
         }
         else
         {
             this.inputPaymentModeId.Value = this.paymentModeId.ToString();
         }
         this.inputPaymentModeId.Value  = this.paymentModeId.ToString();
         this.inputShippingModeId.Value = this.shippingModeId.ToString();
         int shipAddressId = 0;
         int.TryParse(this.Page.Request.QueryString["ShipAddressId"].ToNullString(), out shipAddressId);
         IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(false);
         int regionId = 0;
         IList <ShippingAddressInfo> list = new List <ShippingAddressInfo>();
         ShippingAddressInfo         shippingAddressInfo = null;
         if (shipAddressId > 0)
         {
             shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo a) => a.ShippingId == shipAddressId);
             if (shippingAddressInfo != null)
             {
                 regionId = shippingAddressInfo.RegionId;
             }
         }
         else if (shippingAddresses != null && shippingAddresses.Count > 0)
         {
             regionId = shippingAddresses.FirstOrDefault().RegionId;
         }
         this.hidShipAddressId.Value = shipAddressId.ToString();
         SiteSettings masterSettings = SettingsManager.GetMasterSettings();
         if (masterSettings.OpenMultStore)
         {
             this.hidStoreId.Value = this.storeId.ToString();
             if (this.storeId > 0)
             {
                 StoresInfo storeById = DepotHelper.GetStoreById(this.storeId);
                 this.litStoreName.Text = storeById.StoreName;
                 this.litAddress.Text   = RegionHelper.GetFullRegion(storeById.RegionId, string.Empty, true, 0) + storeById.Address;
                 this.litTel.Text       = storeById.Tel;
             }
             if (this.from != "countdown" && this.from != "groupbuy" && this.from != "presale" && this.shoppingCart.LineItems.Count > 0)
             {
                 string str = this.productSku.Replace(",", "','");
                 str = "'" + str + "'";
                 if (ShoppingCartProcessor.CanGetGoodsOnStore(str))
                 {
                     this.hidGetgoodsOnStores.Value = "true";
                     bool flag = StoresHelper.HasStoresInCity(str, regionId);
                     this.hidHasStoresInCity.Value = (flag ? "true" : "false");
                 }
             }
             else
             {
                 this.hidGetgoodsOnStores.Value = "false";
             }
             PageTitle.AddSiteNameTitle("配送方式和支付方式设置");
         }
     }
 }
Exemple #17
0
        private void ExportToExcel(HttpContext context)
        {
            StoreBalanceQuery query = this.getQuery(context);

            query.PageIndex = 1;
            query.PageSize  = 2147483647;
            DbQueryResult storeBalanceOverOrders = StoresHelper.GetStoreBalanceOverOrders(query);
            decimal       storeBalanceOrderTotal = StoresHelper.GetStoreBalanceOrderTotal(query.StoreId, query.StartDate.Value, query.EndDate.Value);
            StringBuilder stringBuilder          = new StringBuilder();

            stringBuilder.AppendLine("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\" border=\"1\">");
            stringBuilder.AppendLine("<tr style=\"font-weight: bold; white-space: nowrap;\">");
            stringBuilder.AppendLine("<td>门店</td>");
            stringBuilder.AppendLine("<td>结算时间</td>");
            stringBuilder.AppendLine("<td>订单编号</td>");
            stringBuilder.AppendLine("<td>订单实付</td>");
            stringBuilder.AppendLine("<td>退款金额</td>");
            stringBuilder.AppendLine("<td>平台佣金</td>");
            stringBuilder.AppendLine("<td>结算金额</td>");
            stringBuilder.AppendLine("<td>收款方</td>");
            stringBuilder.AppendLine("<td>运费</td>");
            stringBuilder.AppendLine("<td>积分抵扣</td>");
            stringBuilder.AppendLine("<td>优惠券抵扣</td>");
            stringBuilder.AppendLine("</tr>");
            DataTable data = storeBalanceOverOrders.Data;
            DateTime  dateTime;

            foreach (DataRow row in data.Rows)
            {
                stringBuilder.AppendLine("<tr>");
                stringBuilder.AppendLine("<td>" + row.Field <string>("StoreName") + " </td>");
                StringBuilder stringBuilder2 = stringBuilder;
                dateTime = row.Field <DateTime>("CreateTime");
                stringBuilder2.AppendLine("<td>" + dateTime.ToString("yyyy-MM-dd HH:mm:ss") + "</td>");
                stringBuilder.AppendLine("<td style=\"vnd.ms-excel.numberformat:@\">" + row.Field <string>("TradeNo") + "</td>");
                stringBuilder.AppendLine("<td>" + row["OrderTotal"].ToDecimal(0).F2ToString("f2") + "</td>");
                stringBuilder.AppendLine("<td>" + row["RefundAmount"].ToDecimal(0).F2ToString("f2") + "</td>");
                stringBuilder.AppendLine("<td>" + row["PlatCommission"].ToDecimal(0).F2ToString("f2") + "</td>");
                stringBuilder.AppendLine("<td>" + row["Income"].ToDecimal(0).F2ToString("f2") + "</td>");
                if (row["CollectByStore"].ToString() == "1")
                {
                    stringBuilder.AppendLine("<td>门店</td>");
                }
                else
                {
                    stringBuilder.AppendLine("<td>平台</td>");
                }
                stringBuilder.AppendLine("<td>" + row["Freight"].ToDecimal(0).F2ToString("f2") + "</td>");
                stringBuilder.AppendLine("<td>" + row["DeductionMoney"].ToDecimal(0).F2ToString("f2") + "</td>");
                stringBuilder.AppendLine("<td>" + row["CouponValue"].ToDecimal(0).F2ToString("f2") + "</td>");
                stringBuilder.AppendLine("</tr>");
            }
            stringBuilder.AppendLine("<tr>");
            stringBuilder.AppendLine("<td>总结算金额:" + storeBalanceOrderTotal.F2ToString("f2") + "</td>");
            stringBuilder.AppendLine("<td></td>");
            stringBuilder.AppendLine("</tr>");
            stringBuilder.AppendLine("</table>");
            context.Response.Clear();
            context.Response.Buffer  = false;
            context.Response.Charset = "GB2312";
            HttpResponse response = context.Response;

            dateTime = DateTime.Now;
            response.AppendHeader("Content-Disposition", "attachment;filename=StoreBalance_" + dateTime.ToString("yyyyMMddHHmmss") + ".xls");
            context.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
            context.Response.ContentType     = "application/ms-excel";
            context.Response.Write(stringBuilder.ToString());
            context.Response.End();
        }
 public override void OnLoad(HttpContext context)
 {
     base.OnLoad(context);
     if (context.Request["flag"] == "Select")
     {
         IList <StoreFloorInfo> storeFloorList = StoresHelper.GetStoreFloorList(base.CurrentManager.StoreId, FloorClientType.Mobbile);
         string s2 = JsonConvert.SerializeObject(new
         {
             Result = from s in storeFloorList
                      select new
             {
                 s.FloorId,
                 s.FloorName,
                 s.DisplaySequence,
                 s.Quantity
             }
         });
         context.Response.Write(s2);
         context.Response.End();
     }
     if (context.Request["flag"] == "Add")
     {
         int    storeId = base.CurrentManager.StoreId;
         string text    = context.Request["FloorName"].ToNullString();
         int    imageId = context.Request["ImageId"].ToInt(0);
         string text2   = context.Request["ProductIds"].ToNullString();
         if (text.Trim().Length < 1 || text.Trim().Length > 12)
         {
             context.Response.Write(this.GetErrorJosn(101, "楼层名称不能为空,且在1-12个字符之间"));
             return;
         }
         StoreFloorInfo storeFloorInfo = new StoreFloorInfo();
         storeFloorInfo.StoreId         = storeId;
         storeFloorInfo.FloorName       = text;
         storeFloorInfo.ImageId         = imageId;
         storeFloorInfo.FloorClientType = FloorClientType.Mobbile;
         int floorId = StoresHelper.AddStoreFloor(storeFloorInfo);
         if (!string.IsNullOrEmpty(text2))
         {
             StoresHelper.BindStoreFloorProducts(floorId, storeId, text2);
         }
         string s3 = JsonConvert.SerializeObject(new
         {
             Result = new
             {
                 Success = new
                 {
                     Status = true,
                     Msg    = string.Empty
                 }
             }
         });
         context.Response.Write(s3);
         context.Response.End();
     }
     if (context.Request["flag"] == "Mdy")
     {
         int    storeId2 = base.CurrentManager.StoreId;
         int    num      = context.Request["FloorId"].ToInt(0);
         string text3    = context.Request["FloorName"].ToNullString();
         int    imageId2 = context.Request["ImageId"].ToInt(0);
         string text4    = context.Request["ProductIds"].ToNullString();
         if (num <= 0)
         {
             context.Response.Write(this.GetErrorJosn(101, ((Enum)(object)ApiErrorCode.Paramter_Error).ToDescription()));
             return;
         }
         if (text3.Trim().Length < 1 || text3.Trim().Length > 12)
         {
             context.Response.Write(this.GetErrorJosn(101, "楼层名称不能为空,且在1-12个字符之间"));
             return;
         }
         StoreFloorInfo storeFloorInfo2 = new StoreFloorInfo();
         storeFloorInfo2                 = StoresHelper.GetStoreFloorBaseInfo(num);
         storeFloorInfo2.FloorName       = text3;
         storeFloorInfo2.ImageId         = imageId2;
         storeFloorInfo2.FloorClientType = FloorClientType.Mobbile;
         StoresHelper.UpdateStoreFloor(storeFloorInfo2);
         if (!string.IsNullOrEmpty(text4))
         {
             StoresHelper.BindStoreFloorProducts(num, storeId2, text4);
         }
         string s4 = JsonConvert.SerializeObject(new
         {
             Result = new
             {
                 Success = new
                 {
                     Status = true,
                     Msg    = string.Empty
                 }
             }
         });
         context.Response.Write(s4);
         context.Response.End();
     }
     if (context.Request["flag"] == "Delete")
     {
         int storeId3 = base.CurrentManager.StoreId;
         int num2     = context.Request["FloorId"].ToInt(0);
         if (num2 <= 0)
         {
             context.Response.Write(this.GetErrorJosn(101, ((Enum)(object)ApiErrorCode.Paramter_Error).ToDescription()));
             return;
         }
         StoresHelper.DeleteStoreFloor(num2);
         string s5 = JsonConvert.SerializeObject(new
         {
             Result = new
             {
                 Success = new
                 {
                     Status = true,
                     Msg    = string.Empty
                 }
             }
         });
         context.Response.Write(s5);
         context.Response.End();
     }
     if (context.Request["flag"] == "SetDisplaySequence")
     {
         int storeId4 = base.CurrentManager.StoreId;
         int num3     = context.Request["FloorId"].ToInt(0);
         if (num3 <= 0)
         {
             context.Response.Write(this.GetErrorJosn(101, ((Enum)(object)ApiErrorCode.Paramter_Error).ToDescription()));
         }
         else
         {
             int            displaySequence    = context.Request["DisplaySequence"].ToInt(0);
             StoreFloorInfo storeFloorBaseInfo = StoresHelper.GetStoreFloorBaseInfo(num3);
             if (storeFloorBaseInfo == null)
             {
                 context.Response.Write(this.GetErrorJosn(101, "错误的楼层ID"));
             }
             else
             {
                 storeFloorBaseInfo.DisplaySequence = displaySequence;
                 StoresHelper.UpdateStoreFloor(storeFloorBaseInfo);
                 string s6 = JsonConvert.SerializeObject(new
                 {
                     Result = new
                     {
                         Success = new
                         {
                             Status = true,
                             Msg    = string.Empty
                         }
                     }
                 });
                 context.Response.Write(s6);
                 context.Response.End();
             }
         }
     }
 }
Exemple #19
0
        protected override void AttachChildControls()
        {
            int.TryParse(this.Page.Request.QueryString["storeId"], out this.storeId);
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.keyWord = DataHelper.CleanSearchString(this.Page.Request.QueryString["keyWord"]);
            if (!string.IsNullOrWhiteSpace(this.keyWord))
            {
                this.keyWord = HttpUtility.UrlDecode(HttpUtility.UrlDecode(this.keyWord)).Trim();
            }
            this.productIds    = this.Page.Request.QueryString["productIds"];
            this.imgUrl        = (HiImage)this.FindControl("imgUrl");
            this.litContent    = (Literal)this.FindControl("litContent");
            this.rptProducts   = (WapTemplatedRepeater)this.FindControl("rptProducts");
            this.rptCategories = (WapTemplatedRepeater)this.FindControl("rptCategories");
            this.txtTotalPages = (HtmlInputHidden)this.FindControl("txtTotal");
            string text = this.Page.Request.QueryString["sort"];

            if (string.IsNullOrWhiteSpace(text) || (text.ToLower() != "addeddate" && text.ToLower() != "saleprice" && text.ToLower() != "visticounts" && text.ToLower() != "showsalecounts"))
            {
                text = "DisplaySequence";
            }
            string text2 = this.Page.Request.QueryString["order"];

            if (string.IsNullOrWhiteSpace(text2))
            {
                text2 = "desc";
            }
            int pageIndex = default(int);

            if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize = default(int);

            if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize))
            {
                pageSize = 20;
            }
            this.rptCategories.ClientType = base.ClientType;
            IEnumerable <CategoryInfo> subCategories = CatalogHelper.GetSubCategories(this.categoryId);

            this.rptCategories.DataSource = subCategories;
            this.rptCategories.DataBind();
            ProductBrowseQuery productBrowseQuery = new ProductBrowseQuery();

            productBrowseQuery.PageIndex = pageIndex;
            productBrowseQuery.PageSize  = pageSize;
            if (this.storeId.ToInt(0) > 0)
            {
                productBrowseQuery.StoreId = this.storeId;
            }
            if (this.categoryId.ToInt(0) > 0)
            {
                productBrowseQuery.Category = CatalogHelper.GetCategory(this.categoryId);
            }
            productBrowseQuery.Keywords  = this.keyWord;
            productBrowseQuery.SortBy    = "DisplaySequence";
            productBrowseQuery.SortOrder = SortAction.Desc;
            productBrowseQuery.SortBy    = text;
            productBrowseQuery.SortOrder = ((text2 == "asc") ? SortAction.Asc : SortAction.Desc);
            if (!string.IsNullOrEmpty(this.productIds))
            {
                productBrowseQuery.CanUseProducts = this.productIds;
            }
            productBrowseQuery.ProductSaleStatus = ProductSaleStatus.OnSale;
            DbQueryResult storeProductList = StoresHelper.GetStoreProductList(productBrowseQuery);

            this.rptProducts.ClientType = base.ClientType;
            this.rptProducts.DataSource = storeProductList.Data;
            this.rptProducts.DataBind();
            this.txtTotalPages.SetWhenIsNotNull(storeProductList.TotalRecords.ToString());
            PageTitle.AddSiteNameTitle("分类搜索页");
        }
 private void rptOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         HtmlAnchor         htmlAnchor           = (HtmlAnchor)e.Item.FindControl("lkbtnCouponCode");
         HtmlAnchor         htmlAnchor2          = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund");
         HtmlAnchor         htmlAnchor3          = (HtmlAnchor)e.Item.FindControl("lnkClose");
         HtmlAnchor         htmlAnchor4          = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
         HtmlAnchor         htmlAnchor5          = (HtmlAnchor)e.Item.FindControl("lkbtnProductReview");
         Literal            literal              = (Literal)e.Item.FindControl("ltlOrderItems");
         Literal            literal2             = (Literal)e.Item.FindControl("ltlOrderGifts");
         HtmlGenericControl htmlGenericControl   = e.Item.FindControl("panelOperaters") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl2  = e.Item.FindControl("divToDetail") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl3  = e.Item.FindControl("divOrderStatus") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl4  = e.Item.FindControl("divOrderError") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl5  = e.Item.FindControl("divOrderGifts") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl6  = e.Item.FindControl("divOrderItems") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl7  = (HtmlGenericControl)e.Item.FindControl("OrderIdSpan");
         HtmlGenericControl htmlGenericControl8  = (HtmlGenericControl)e.Item.FindControl("PayMoneySpan");
         HtmlGenericControl htmlGenericControl9  = (HtmlGenericControl)e.Item.FindControl("TakeCodeDIV");
         HtmlAnchor         htmlAnchor6          = (HtmlAnchor)e.Item.FindControl("lnkViewLogistics");
         HtmlAnchor         htmlAnchor7          = (HtmlAnchor)e.Item.FindControl("lnkToPay");
         HtmlAnchor         htmlAnchor8          = (HtmlAnchor)e.Item.FindControl("lnkHelpLink");
         HtmlAnchor         htmlAnchor9          = (HtmlAnchor)e.Item.FindControl("lnkFinishOrder");
         HtmlAnchor         htmlAnchor10         = (HtmlAnchor)e.Item.FindControl("lnkViewTakeCodeQRCode");
         HtmlAnchor         htmlAnchor11         = (HtmlAnchor)e.Item.FindControl("lnkCertification");
         HtmlGenericControl htmlGenericControl10 = (HtmlGenericControl)e.Item.FindControl("divSendRedEnvelope");
         OrderStatus        orderStatus          = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
         Repeater           repeater             = (Repeater)e.Item.FindControl("Repeater1");
         Repeater           repeater2            = (Repeater)e.Item.FindControl("rptPointGifts");
         this.paymenttypeselect = (Common_WAPPaymentTypeSelect)this.FindControl("paymenttypeselect");
         Literal   literal3  = (Literal)e.Item.FindControl("litGiftTitle");
         string    text      = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
         OrderInfo orderInfo = TradeHelper.GetOrderInfo(text);
         if (orderInfo != null)
         {
             if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History)
             {
                 WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                 bool visible = false;
                 if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                 {
                     visible = true;
                 }
                 if (htmlGenericControl10 != null)
                 {
                     htmlGenericControl10.Visible = visible;
                     if (this.isVShop)
                     {
                         htmlGenericControl10.InnerHtml = "<a href=\"/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId + "\"></a>";
                     }
                     else
                     {
                         htmlGenericControl10.InnerHtml = "";
                         string text2 = Globals.HttpsFullPath("/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId);
                         htmlGenericControl10.Attributes.Add("onclick", string.Format("ShowMsg('{0}','{1}')", "代金红包请前往微信端领取!", "false"));
                     }
                 }
             }
             this.paymenttypeselect.ClientType = base.ClientType;
             htmlGenericControl4.Visible       = (orderInfo.IsError && orderInfo.CloseReason != "订单已退款完成");
             htmlGenericControl3.Visible       = !orderInfo.IsError;
             htmlGenericControl5.Visible       = (orderInfo.LineItems.Count() == 0);
             htmlGenericControl6.Visible       = (orderInfo.LineItems.Count() > 0);
             htmlAnchor2.HRef   = "ApplyRefund.aspx?OrderId=" + text;
             htmlAnchor.Visible = false;
             htmlAnchor.HRef    = "MemberOrdersVCode?OrderId=" + text;
             HtmlGenericControl htmlGenericControl11 = (HtmlGenericControl)e.Item.FindControl("OrderSupplierH3");
             string             text3 = string.Empty;
             if (htmlGenericControl11 != null)
             {
                 text3 = htmlGenericControl11.Attributes["class"];
                 text3 = ((!string.IsNullOrEmpty(text3)) ? text3.Replace(" ztitle", "").Replace("stitle", "") : "");
             }
             if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P"))
             {
                 if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName))
                 {
                     htmlGenericControl7.InnerText = orderInfo.StoreName;
                     text3 += " mtitle";
                 }
                 else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0)
                 {
                     htmlGenericControl7.InnerText = orderInfo.ShipperName;
                     text3 += " stitle";
                 }
                 else
                 {
                     htmlGenericControl7.InnerText = "平台";
                     text3 += " ztitle";
                 }
                 htmlGenericControl11.Attributes["class"] = text3;
                 if (orderInfo.LineItems.Count <= 0)
                 {
                     literal3.Text = "(礼)";
                 }
             }
             else
             {
                 htmlGenericControl7.InnerText            = orderInfo.OrderId;
                 htmlGenericControl11.Attributes["class"] = text3;
             }
             if (orderInfo.PreSaleId > 0)
             {
                 htmlGenericControl8.InnerText = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2");
             }
             else
             {
                 htmlGenericControl8.InnerText = Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "OrderTotal")).F2ToString("f2");
             }
             if (htmlGenericControl2 != null)
             {
                 if (orderInfo.OrderType == OrderType.ServiceOrder)
                 {
                     htmlGenericControl2.Attributes.Add("onclick", "window.location.href='ServiceMemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'");
                 }
                 else
                 {
                     htmlGenericControl2.Attributes.Add("onclick", "window.location.href='MemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'");
                 }
             }
             if (htmlAnchor6 != null)
             {
                 if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent || orderInfo.OrderStatus == OrderStatus.Finished)
                 {
                     if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber))
                     {
                         htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text;
                     }
                     else if (orderInfo.ExpressCompanyName == "同城物流配送")
                     {
                         htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text;
                     }
                     else
                     {
                         htmlAnchor6.Visible = false;
                     }
                 }
                 else
                 {
                     htmlAnchor6.Visible = false;
                 }
             }
             if (htmlAnchor10 != null)
             {
                 htmlAnchor10.HRef = "ViewQRCode.aspx?orderId=" + orderInfo.OrderId;
             }
             int num4;
             if (htmlAnchor5 != null && ((orderStatus == OrderStatus.Finished && orderInfo.LineItems.Count > 0) || (orderStatus == OrderStatus.Closed && orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count && orderInfo.LineItems.Count > 0)))
             {
                 htmlAnchor5.Visible = true;
                 htmlAnchor5.HRef    = "MemberSubmitProductReview.aspx?orderId=" + text;
                 DataTable    productReviewAll = ProductBrowser.GetProductReviewAll(text);
                 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++)
                     {
                         num4 = lineItemInfo.ProductId;
                         if (num4.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)
                 {
                     htmlAnchor5.InnerText = "查看评论";
                 }
                 else
                 {
                     SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                     if (masterSettings != null)
                     {
                         if (masterSettings.ProductCommentPoint <= 0)
                         {
                             htmlAnchor5.InnerText = "评价";
                         }
                         else
                         {
                             htmlAnchor5.InnerText = $"评价得{num3 * masterSettings.ProductCommentPoint}积分";
                         }
                     }
                 }
             }
             if (htmlAnchor3 != null && orderStatus == OrderStatus.WaitBuyerPay)
             {
                 if (orderInfo.PreSaleId == 0 || (orderInfo.PreSaleId > 0 && !orderInfo.DepositDate.HasValue))
                 {
                     htmlAnchor3.Visible = true;
                 }
                 htmlAnchor3.Attributes.Add("onclick", $"closeOrder('{text}')");
             }
             DateTime dateTime;
             if (htmlAnchor7 != null)
             {
                 if (orderStatus == OrderStatus.WaitBuyerPay && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.PaymentTypeId != -3 && orderInfo.Gateway != "hishop.plugins.payment.bankrequest" && orderInfo.Gateway != "hishop.plugins.payment.podrequest")
                 {
                     htmlAnchor7.Attributes.Add("IsServiceOrder", (orderInfo.OrderType == OrderType.ServiceOrder).ToString().ToLower());
                     if (orderInfo.PreSaleId > 0)
                     {
                         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                         if (!orderInfo.DepositDate.HasValue)
                         {
                             htmlGenericControl8.InnerText = orderInfo.Deposit.F2ToString("f2");
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥";
                             if (productPreSaleInfo.PreSaleEndDate > DateTime.Now)
                             {
                                 AttributeCollection attributes = htmlAnchor7.Attributes;
                                 num4 = orderInfo.PaymentTypeId;
                                 attributes.Add("PaymentTypeId", num4.ToString());
                                 htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                                 htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.Deposit.F2ToString("f2"));
                                 AttributeCollection attributes2 = htmlAnchor7.Attributes;
                                 num4 = orderInfo.FightGroupId;
                                 attributes2.Add("FightGroupId", num4.ToString());
                             }
                             else
                             {
                                 htmlAnchor7.Visible = false;
                                 (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥";
                             }
                         }
                         else if (productPreSaleInfo.PaymentStartDate > DateTime.Now || productPreSaleInfo.PaymentEndDate < DateTime.Now)
                         {
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥";
                             htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2");
                             htmlAnchor7.Visible           = false;
                             htmlAnchor3.Visible           = false;
                             if (productPreSaleInfo.PaymentEndDate < DateTime.Now)
                             {
                                 (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款支付结束";
                                 htmlGenericControl8.Visible = false;
                             }
                         }
                         else
                         {
                             AttributeCollection attributes3 = htmlAnchor7.Attributes;
                             num4 = orderInfo.PaymentTypeId;
                             attributes3.Add("PaymentTypeId", num4.ToString());
                             htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                             htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.FinalPayment.F2ToString("f2"));
                             AttributeCollection attributes4 = htmlAnchor7.Attributes;
                             num4 = orderInfo.FightGroupId;
                             attributes4.Add("FightGroupId", num4.ToString());
                             htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2");
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥";
                             htmlAnchor3.Visible = false;
                         }
                     }
                     else
                     {
                         AttributeCollection attributes5 = htmlAnchor7.Attributes;
                         num4 = orderInfo.PaymentTypeId;
                         attributes5.Add("PaymentTypeId", num4.ToString());
                         htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                         htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.GetTotal(false).F2ToString("f2"));
                         AttributeCollection attributes6 = htmlAnchor7.Attributes;
                         num4 = orderInfo.FightGroupId;
                         attributes6.Add("FightGroupId", num4.ToString());
                         if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                         {
                             StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId);
                             dateTime = DateTime.Now;
                             string str = dateTime.ToString("yyyy-MM-dd");
                             dateTime = storeById.OpenStartDate;
                             DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                             dateTime = DateTime.Now;
                             string str2 = dateTime.ToString("yyyy-MM-dd");
                             dateTime = storeById.OpenEndDate;
                             DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                             if (dateTime2 <= value)
                             {
                                 dateTime2 = dateTime2.AddDays(1.0);
                             }
                             if (DateTime.Now < value || DateTime.Now > dateTime2)
                             {
                                 htmlAnchor7.Attributes.Add("NeedNotInTimeTip", "1");
                             }
                         }
                     }
                 }
                 else
                 {
                     htmlAnchor7.Visible = false;
                 }
             }
             if (htmlAnchor8 != null)
             {
                 if (orderInfo.Gateway == "hishop.plugins.payment.bankrequest" && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                 {
                     htmlAnchor8.HRef = "FinishOrder.aspx?OrderId=" + text + "&onlyHelp=true";
                 }
                 else
                 {
                     htmlAnchor8.Visible = false;
                 }
             }
             if (htmlAnchor9 != null)
             {
                 if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                 {
                     htmlAnchor9.Attributes.Add("onclick", $"FinishOrder('{text}','{orderInfo.PaymentType}',{orderInfo.LineItems.Count})");
                 }
                 else
                 {
                     htmlAnchor9.Visible = false;
                 }
             }
             if (htmlAnchor11 != null)
             {
                 if (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods)
                 {
                     htmlAnchor11.Attributes.Add("orderId", orderInfo.OrderId);
                     htmlAnchor11.Attributes.Add("onclick", "Certification(this)");
                     htmlAnchor11.Visible = true;
                 }
                 else
                 {
                     htmlAnchor11.Visible = false;
                 }
             }
             if (literal != null)
             {
                 Literal literal4 = literal;
                 num4          = this.GetGoodsNum(orderInfo);
                 literal4.Text = num4.ToString();
             }
             if (literal2 != null)
             {
                 Literal literal5 = literal2;
                 num4          = this.GetGiftsNum(orderInfo);
                 literal5.Text = num4.ToString();
             }
             if (orderInfo.OrderType == OrderType.ServiceOrder)
             {
                 Label label = (Label)e.Item.FindControl("OrderStatusLabel2");
                 IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(orderInfo.OrderId);
                 ServiceOrderStatus orderStatus2 = this.GetOrderStatus(orderInfo, orderVerificationItems);
                 label.Text    = ((Enum)(object)orderStatus2).ToDescription();
                 label.Visible = true;
             }
             else
             {
                 OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("OrderStatusLabel1");
                 orderStatusLabel.OrderItemStatus    = ((orderInfo.ItemStatus != 0) ? OrderItemStatus.HasReturnOrReplace : OrderItemStatus.Nomarl);
                 orderStatusLabel.Gateway            = orderInfo.Gateway;
                 orderStatusLabel.OrderStatusCode    = orderInfo.OrderStatus;
                 orderStatusLabel.ShipmentModelId    = orderInfo.ShippingModeId;
                 orderStatusLabel.IsConfirm          = orderInfo.IsConfirm;
                 orderStatusLabel.ShipmentModelId    = orderInfo.ShippingModeId;
                 orderStatusLabel.PaymentTypeId      = orderInfo.PaymentTypeId;
                 orderStatusLabel.PreSaleId          = orderInfo.PreSaleId;
                 orderStatusLabel.DepositDate        = orderInfo.DepositDate;
                 orderStatusLabel.OrderType          = orderInfo.OrderType;
                 orderStatusLabel.ExpressCompanyName = orderInfo.ExpressCompanyName;
                 orderStatusLabel.DadaStatus         = orderInfo.DadaStatus;
                 orderStatusLabel.Visible            = true;
             }
             Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
             foreach (string key in lineItems.Keys)
             {
                 lineItems[key].IsValid = (orderInfo.OrderType == OrderType.ServiceOrder);
             }
             repeater.DataSource     = lineItems.Values;
             repeater.ItemDataBound += this.Repeater1_ItemDataBound;
             repeater.DataBind();
             if (orderInfo.LineItems.Count == 0)
             {
                 IEnumerable <OrderGiftInfo> enumerable = from a in orderInfo.Gifts
                                                          where a.PromoteType == 0 || a.PromoteType == 15
                                                          select a;
                 foreach (OrderGiftInfo item in enumerable)
                 {
                     item.NeedPoint = ((orderInfo.OrderType == OrderType.ServiceOrder) ? 1 : 0);
                 }
                 repeater2.DataSource     = enumerable;
                 repeater2.ItemDataBound += this.rptPointGifts_ItemDataBound;
                 repeater2.DataBind();
             }
             OrderItemStatus itemStatus = orderInfo.ItemStatus;
             DateTime        obj;
             if (DataBinder.Eval(e.Item.DataItem, "FinishDate") != DBNull.Value)
             {
                 obj = (DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate");
             }
             else
             {
                 dateTime = DateTime.Now;
                 obj      = dateTime.AddYears(-1);
             }
             DateTime dateTime3 = obj;
             string   text4     = "";
             if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
             {
                 text4 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
             }
             RefundInfo refundInfo = TradeHelper.GetRefundInfo(text);
             if (htmlAnchor2 != null)
             {
                 if (orderInfo.OrderType == OrderType.ServiceOrder)
                 {
                     htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0);
                     if (htmlAnchor2.Visible)
                     {
                         LineItemInfo value2 = orderInfo.LineItems.FirstOrDefault().Value;
                         if (value2.IsRefund)
                         {
                             if (value2.IsOverRefund)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else if (value2.IsValid)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else if (DateTime.Now >= value2.ValidStartDate.Value && DateTime.Now <= value2.ValidEndDate.Value)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else
                             {
                                 htmlAnchor2.Visible = false;
                             }
                         }
                         else
                         {
                             htmlAnchor2.Visible = false;
                         }
                     }
                 }
                 else
                 {
                     htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0 && orderInfo.GetPayTotal() > decimal.Zero);
                 }
             }
             if (htmlAnchor != null)
             {
                 htmlAnchor.Visible = (orderInfo.OrderType == OrderType.ServiceOrder && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
             }
             SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
             if (!string.IsNullOrEmpty(orderInfo.TakeCode) && (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.WaitBuyerPay))
             {
                 htmlAnchor10.Visible = true;
             }
             if (!htmlAnchor2.Visible && !htmlAnchor4.Visible && !htmlAnchor10.Visible && !htmlAnchor6.Visible && !htmlAnchor3.Visible && !htmlAnchor7.Visible && !htmlAnchor8.Visible && !htmlAnchor9.Visible && !htmlAnchor5.Visible && !htmlAnchor.Visible)
             {
                 htmlGenericControl.Visible = false;
             }
             if (orderInfo.FightGroupId > 0)
             {
                 FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                 if (fightGroup != null)
                 {
                     htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                 }
             }
         }
     }
 }
Exemple #21
0
        protected override void AttachChildControls()
        {
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.fightGroupRule          = (Common_FightGroupRule)this.FindControl("fightGroupRule");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            int fightGroupId = this.Page.Request["fightGroupId"].ToInt(0);

            this.litDescription           = (Literal)this.FindControl("litDescription");
            this.litConsultationsCount    = (Literal)this.FindControl("litConsultationsCount");
            this.hfStartTime              = (HtmlInputHidden)this.FindControl("hfStartTime");
            this.hiddenJoinedUser         = (HtmlInputText)this.FindControl("hiddenJoinedUser");
            this.hfEndTime                = (HtmlInputHidden)this.FindControl("hfEndTime");
            this.hfNowTime                = (HtmlInputHidden)this.FindControl("hfNowTime");
            this.rptFightGroupDetails     = (WapTemplatedRepeater)this.FindControl("rptFightGroupDetails");
            this.rptFightGroupDetailsNeed = (WapTemplatedRepeater)this.FindControl("rptFightGroupDetailsNeed");
            this.litNeedPerson            = (Literal)this.FindControl("litNeedPerson");
            this.divIn                       = (HtmlControl)this.FindControl("divIn");
            this.divOver                     = (HtmlControl)this.FindControl("divOver");
            this.skuSubmitOrder              = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.litProductReviewCount       = (Literal)this.FindControl("litProductReviewCount");
            this.litJoinNumber               = (Literal)this.FindControl("litJoinNumber");
            this.litLimitedHour              = (Literal)this.FindControl("litLimitedHour");
            this.litProductName              = (Literal)this.FindControl("litProductName");
            this.litFGAPrice                 = (Literal)this.FindControl("litFGAPrice");
            this.litPPrice                   = (Literal)this.FindControl("litPPrice");
            this.imgStatus                   = (Image)this.FindControl("imgStatus");
            this.litRemainTimeHtml           = (HtmlGenericControl)this.FindControl("litRemainTimeHtml");
            this.spanTime                    = (HtmlGenericControl)this.FindControl("spanTime");
            this.hiddenProductId             = (HtmlInputText)this.FindControl("hiddenProductId");
            this.hlProductReview             = (HyperLink)this.FindControl("hlProductReview");
            this.hidFightGroupActivityStatus = (HtmlInputHidden)this.FindControl("hidFightGroupActivityStatus");
            this.divGetBySelf                = (HtmlControl)this.FindControl("divGetBySelf");
            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.hdAppId.Value               = base.site.WeixinAppId;
            FightGroupInfo fightGroup = VShopHelper.GetFightGroup(fightGroupId);

            if (fightGroup != null)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                if (masterSettings.OpenMultStore && StoresHelper.ProductHasStores(fightGroup.ProductId))
                {
                    this.divGetBySelf.Visible = true;
                }
                if (fightGroup.EndTime <= DateTime.Now && fightGroup.Status == FightGroupStatus.FightGroupIn)
                {
                    VShopHelper.DealFightGroupFail(fightGroupId);
                    fightGroup.Status = FightGroupStatus.FightGroupFail;
                }
                this.fightGroupRule.FightGroupActivityId = fightGroup.FightGroupActivityId;
                FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(fightGroup.FightGroupActivityId);
                HtmlInputText          htmlInputText           = this.hiddenProductId;
                int num = fightGroup.ProductId;
                htmlInputText.Value = num.ToString();
                this.hidFightGroupActivityStatus.Value = ((fightGroupActivitieInfo.EndDate > DateTime.Now) ? "1" : "0");
                HtmlInputHidden htmlInputHidden = this.hfNowTime;
                DateTime        dateTime        = DateTime.Now;
                htmlInputHidden.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                HtmlInputHidden htmlInputHidden2 = this.hfEndTime;
                dateTime = fightGroup.EndTime;
                htmlInputHidden2.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                HtmlInputHidden htmlInputHidden3 = this.hfStartTime;
                dateTime = fightGroup.StartTime;
                htmlInputHidden3.Value           = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                this.hlProductReview.NavigateUrl = $"/vshop/ProductReview.aspx?ProductId={fightGroup.ProductId}";
                IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(fightGroup.FightGroupActivityId);
                Literal literal = this.litJoinNumber;
                num          = fightGroup.JoinNumber;
                literal.Text = num.ToString();
                Literal literal2 = this.litLimitedHour;
                num                      = fightGroupActivitieInfo.LimitedHour;
                literal2.Text            = num.ToString();
                this.litProductName.Text = fightGroup.ProductName;
                this.litFGAPrice.Text    = fightGroupSkus.Min((FightGroupSkuInfo c) => c.SalePrice).F2ToString("f2");
                IList <int> list = null;
                Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >);
                ProductInfo productDetails = ProductHelper.GetProductDetails(fightGroup.ProductId, out dictionary, out list);
                if (productDetails != null)
                {
                    this.litPPrice.Text                      = productDetails.MaxSalePrice.F2ToString("f2");
                    this.skuSubmitOrder.ProductInfo          = productDetails;
                    this.skuSubmitOrder.OrderBusiness        = 1;
                    this.skuSubmitOrder.FightGroupActivityId = fightGroup.FightGroupActivityId;
                    this.skuSubmitOrder.FightGroupId         = fightGroup.FightGroupId;
                }
                Literal literal3 = this.litProductReviewCount;
                num = ProductBrowser.GetProductReviews(new ProductReviewQuery
                {
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    ProductId = fightGroupActivitieInfo.ProductId
                }).TotalRecords;
                literal3.Text = num.ToString();
                FightGroupStatus status = fightGroup.Status;
                if (status.Equals(FightGroupStatus.FightGroupFail))
                {
                    this.imgStatus.ImageUrl = "/Templates/common/images/fg_fail.png";
                    this.imgStatus.Attributes.Add("class", "fg_fail");
                    this.spanTime.Style.Add("text-align", "center");
                    this.litRemainTimeHtml.Style.Add("display", "none");
                }
                else
                {
                    status = fightGroup.Status;
                    if (status.Equals(FightGroupStatus.FightGroupSuccess))
                    {
                        this.imgStatus.ImageUrl = "/Templates/common/images/fg_ok.png";
                        this.imgStatus.Attributes.Add("class", "fg_ok");
                    }
                }
                Image image = this.imgStatus;
                status        = fightGroup.Status;
                image.Visible = !status.Equals(FightGroupStatus.FightGroupIn);
                int fightGroupActiveNumber = VShopHelper.GetFightGroupActiveNumber(fightGroup.FightGroupId);
                int num2 = fightGroup.JoinNumber - fightGroupActiveNumber;
                num2 = ((num2 >= 0) ? num2 : 0);
                this.litNeedPerson.Text = num2.ToString();
                HtmlControl htmlControl = this.divIn;
                status = fightGroup.Status;
                htmlControl.Visible = status.Equals(FightGroupStatus.FightGroupIn);
                HtmlControl htmlControl2 = this.divOver;
                status = fightGroup.Status;
                htmlControl2.Visible = !status.Equals(FightGroupStatus.FightGroupIn);
                IList <FightGroupUserModel> fightGroupUsers = VShopHelper.GetFightGroupUsers(fightGroup.FightGroupId);
                foreach (FightGroupUserModel item in fightGroupUsers)
                {
                    item.Name = DataHelper.GetHiddenUsername(item.Name);
                    if (HiContext.Current.UserId == item.UserId)
                    {
                        this.hiddenJoinedUser.Value = "true";
                    }
                }
                this.rptFightGroupDetails.DataSource = fightGroupUsers;
                this.rptFightGroupDetails.DataBind();
                List <int> list2 = new List <int>();
                for (int i = 0; i < num2; i++)
                {
                    list2.Add(i);
                }
                this.rptFightGroupDetailsNeed.DataSource = list2;
                this.rptFightGroupDetailsNeed.DataBind();
                Literal control = this.litConsultationsCount;
                num = ProductBrowser.GetProductConsultationsCount(productDetails.ProductId, true);
                control.SetWhenIsNotNull(num.ToString());
                if (this.litDescription != null)
                {
                    string text  = "";
                    Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                    if (!string.IsNullOrWhiteSpace(productDetails.MobbileDescription))
                    {
                        text = regex.Replace(productDetails.MobbileDescription, "");
                    }
                    else if (!string.IsNullOrWhiteSpace(productDetails.Description))
                    {
                        text = regex.Replace(productDetails.Description, "");
                    }
                    text = text.Replace("src", "data-url");
                    this.litDescription.Text = text;
                }
                if (this.rptProductImages != null)
                {
                    string locationUrl = "javascript:;";
                    if (string.IsNullOrEmpty(productDetails.ImageUrl1) && string.IsNullOrEmpty(productDetails.ImageUrl2) && string.IsNullOrEmpty(productDetails.ImageUrl3) && string.IsNullOrEmpty(productDetails.ImageUrl4) && string.IsNullOrEmpty(productDetails.ImageUrl5))
                    {
                        productDetails.ImageUrl1 = masterSettings.DefaultProductImage;
                    }
                    DataTable         skus  = ProductBrowser.GetSkus(fightGroupActivitieInfo.ProductId);
                    List <SlideImage> list3 = new List <SlideImage>();
                    foreach (DataRow row in skus.Rows)
                    {
                        List <SlideImage> list4 = (from s in list3
                                                   where s.ImageUrl == row["ThumbnailUrl410"].ToString()
                                                   select s).ToList();
                        if (list4.Count <= 0)
                        {
                            list3.Add(new SlideImage(row["ThumbnailUrl410"].ToString(), locationUrl));
                        }
                    }
                    list3.Add(new SlideImage(productDetails.ImageUrl1, locationUrl));
                    list3.Add(new SlideImage(productDetails.ImageUrl2, locationUrl));
                    list3.Add(new SlideImage(productDetails.ImageUrl3, locationUrl));
                    list3.Add(new SlideImage(productDetails.ImageUrl4, locationUrl));
                    list3.Add(new SlideImage(productDetails.ImageUrl5, locationUrl));
                    this.rptProductImages.DataSource = from item in list3
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                }
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareTitle))
                {
                    this.hdTitle.Value = (string.IsNullOrEmpty(productDetails.Title) ? productDetails.ProductName : productDetails.Title);
                }
                else
                {
                    this.hdTitle.Value = fightGroupActivitieInfo.ShareTitle.Trim();
                }
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareContent.Trim()))
                {
                    this.hdDesc.Value = productDetails.Meta_Description;
                }
                else
                {
                    this.hdDesc.Value = fightGroupActivitieInfo.ShareContent.Trim();
                }
                string icon = fightGroupActivitieInfo.Icon;
                this.hdImgUrl.Value = Globals.FullPath(string.IsNullOrEmpty(icon) ? base.site.DefaultProductThumbnail8 : icon);
                this.hdLink.Value   = Globals.FullPath(this.Page.Request.Url.ToString());
                DataTable data = ProductBrowser.GetProductConsultations(new ProductConsultationAndReplyQuery
                {
                    ProductId = productDetails.ProductId,
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    SortOrder = SortAction.Desc,
                    SortBy    = "ConsultationId"
                }).Data;
                for (int j = 0; j < data.Rows.Count; j++)
                {
                    data.Rows[j]["UserName"] = DataHelper.GetHiddenUsername(data.Rows[j]["UserName"].ToNullString());
                }
                this.rptProductConsultations.DataSource = data;
                this.rptProductConsultations.DataBind();
                this.divConsultationEmpty.Visible = data.IsNullOrEmpty();
            }
            else
            {
                base.GotoResourceNotFound("活动不存在");
            }
        }
Exemple #22
0
        protected override void AttachChildControls()
        {
            this.isOffline      = this.Page.Request["IsOffline"].ToBool();
            this.orderId        = Globals.StripAllTags(this.Page.Request.QueryString["orderId"].ToNullString());
            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.linkToDetail   = (HtmlAnchor)this.FindControl("linkToDetail");
            this.litErrorMsg    = (Literal)this.FindControl("litErrorMsg");
            this.loadPanel      = (HtmlGenericControl)this.FindControl("loadPanel");
            this.errorPanel     = (HtmlGenericControl)this.FindControl("errorPanel");
            this.btnToPay       = (HtmlAnchor)this.FindControl("btnToPay");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       text           = "";
            string       userAgent      = HttpContext.Current.Request.UserAgent;

            this.loadPanel.Visible = true;
            StoreCollectionInfo storeCollectionInfo = null;

            if (this.isOffline)
            {
                storeCollectionInfo = StoresHelper.GetStoreCollectionInfo(this.orderId);
                if (storeCollectionInfo == null)
                {
                    this.litErrorMsg.Text   = "错误的订单编号";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                    return;
                }
                if (storeCollectionInfo.Status != 0)
                {
                    this.litErrorMsg.Text   = "订单状态不是待支付状态";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                    return;
                }
                if (this.linkToDetail != null)
                {
                    this.linkToDetail.Visible = false;
                }
            }
            else
            {
                this.order = ShoppingProcessor.GetOrderInfo(this.orderId);
                if (this.order == null)
                {
                    this.litErrorMsg.Text   = "错误的订单编号";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                    return;
                }
                if (this.order.OrderStatus != OrderStatus.WaitBuyerPay)
                {
                    this.litErrorMsg.Text   = "订单状态不是待支付状态";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                    return;
                }
                storeCollectionInfo      = StoresHelper.GetStoreCollectionInfoOfOrderId(this.orderId);
                this.litPaymentName.Text = this.order.PaymentType;
                this.litPaymentType.SetWhenIsNotNull(this.order.PaymentTypeId.ToString());
                this.litOrderId.SetWhenIsNotNull(this.orderId);
                this.litOrderTotal.SetWhenIsNotNull(this.order.GetTotal(false).F2ToString("f2"));
                if (this.linkToDetail != null)
                {
                    this.linkToDetail.Visible = true;
                    this.linkToDetail.HRef    = "MemberOrderDetails?OrderId=" + this.orderId;
                }
            }
            if (base.ClientType == ClientType.VShop)
            {
                if (!string.IsNullOrEmpty(masterSettings.WeixinAppId) && !string.IsNullOrEmpty(masterSettings.WeixinAppSecret) && !string.IsNullOrEmpty(masterSettings.WeixinPartnerID) && !string.IsNullOrEmpty(masterSettings.WeixinPartnerKey))
                {
                    if (!this.isOffline)
                    {
                        this.order.Gateway       = "hishop.plugins.payment.weixinrequest";
                        this.order.PaymentTypeId = -2;
                        this.order.PaymentType   = "微信支付";
                        TradeHelper.UpdateOrderPaymentType(this.order);
                    }
                    if (storeCollectionInfo != null)
                    {
                        storeCollectionInfo.GateWay         = "hishop.plugins.payment.weixinrequest";
                        storeCollectionInfo.PaymentTypeName = "微信支付";
                        storeCollectionInfo.PaymentTypeId   = 1;
                        StoresHelper.UpdateStoreCollectionInfo(storeCollectionInfo);
                    }
                    HttpContext.Current.Response.Redirect("~/pay/wx_Submit?orderId=" + this.orderId + "&IsOffline=" + this.isOffline.ToString() + "&from=appstore");
                }
                else
                {
                    this.litErrorMsg.Text   = "未配置微信支付";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                }
            }
            else
            {
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");
                if (paymentMode != null)
                {
                    decimal  amount     = default(decimal);
                    string   subject    = "门店APP订单支付";
                    string   buyerEmail = "";
                    DateTime date       = DateTime.Now;
                    if (!this.isOffline)
                    {
                        subject                  = "门店APP线下支付";
                        text                     = paymentMode.Gateway;
                        this.order.Gateway       = paymentMode.Gateway;
                        this.order.PaymentTypeId = paymentMode.ModeId;
                        this.order.PaymentType   = paymentMode.Name;
                        TradeHelper.UpdateOrderPaymentType(this.order);
                        amount     = this.order.GetTotal(false);
                        buyerEmail = this.order.EmailAddress;
                        date       = this.order.OrderDate;
                    }
                    if (storeCollectionInfo != null)
                    {
                        amount = storeCollectionInfo.PayAmount;
                        storeCollectionInfo.GateWay         = paymentMode.Gateway;
                        storeCollectionInfo.PaymentTypeName = paymentMode.Name;
                        storeCollectionInfo.PaymentTypeId   = 2;
                        StoresHelper.UpdateStoreCollectionInfo(storeCollectionInfo);
                        date = storeCollectionInfo.CreateTime;
                    }
                    string         attach         = "";
                    string         showUrl        = string.Format("http://{0}/{1}/", HttpContext.Current.Request.Url.Host, "AliOH");
                    PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, amount, subject, "订单号-" + this.orderId, buyerEmail, date, showUrl, Globals.FullPath("/pay/appstore_wapalipay_return_url"), Globals.FullPath("/pay/appstore_wapalipay_notify_url"), attach);
                    paymentRequest.SendRequest();
                }
                else
                {
                    this.litErrorMsg.Text   = "未配置支付宝网页支付";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                }
            }
        }
Exemple #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NameValueCollection headers = base.Request.Headers;
            string text = "";

            if (headers.AllKeys.Contains("Forwarded"))
            {
                text = headers["Forwarded"].ToNullString();
            }
            OrderInfo    orderInfo      = null;
            PackageInfo  packageInfo    = new PackageInfo();
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            bool         flag           = this.Page.Request["IsOffline"].ToBool();
            string       a      = this.Page.Request["from"].ToNullString().ToLower();
            string       text2  = this.Page.Request.QueryString.Get("orderId");
            string       empty  = string.Empty;
            string       empty2 = string.Empty;
            decimal      d;

            if (a == "appstore")
            {
                this.isOfflineOrder = "true";
                if (string.IsNullOrEmpty(text2))
                {
                    this.litError.Text = "错误的订单号,不能进行支付!";
                    return;
                }
                empty = text2;
                d     = default(decimal);
                StoreCollectionInfo storeCollectionInfo = null;
                if (flag)
                {
                    this.isOfflineOrder = "true";
                    storeCollectionInfo = StoresHelper.GetStoreCollectionInfo(text2);
                    if (storeCollectionInfo == null)
                    {
                        this.litError.Text = "订单状态错误,不能进行支付!";
                    }
                    else if (storeCollectionInfo.Status == 0)
                    {
                        d = storeCollectionInfo.PayAmount;
                        goto IL_0309;
                    }
                    return;
                }
                orderInfo = ShoppingProcessor.GetOrderInfo(text2);
                if (orderInfo == null)
                {
                    this.litError.Text = "错误的订单信息,不能进行支付!";
                    return;
                }
                if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
                {
                    if (orderInfo.OrderSource == OrderSource.Alioh)
                    {
                        base.Response.Redirect("/AliOH/MemberOrderDetails?OrderId=" + orderInfo.OrderId);
                    }
                    else
                    {
                        base.Response.Redirect("/WapShop/MemberOrderDetails?OrderId=" + orderInfo.OrderId);
                    }
                    return;
                }
                this.IsServiceOrder = ((orderInfo.OrderType == OrderType.ServiceOrder) ? "true" : "false");
                if (orderInfo.PreSaleId > 0)
                {
                    if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        empty = orderInfo.OrderId;
                        d     = orderInfo.Deposit - orderInfo.BalanceAmount;
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (orderInfo.PayRandCode.ToInt(0) == 0)
                        {
                            int num = orderInfo.PayRandCode.ToInt(0);
                            num = ((num >= 100) ? (num + 1) : 100);
                            orderInfo.PayRandCode = num.ToString();
                            OrderHelper.UpdateOrderPaymentTypeOfAPI(orderInfo);
                        }
                        empty = orderInfo.PayOrderId;
                        d     = orderInfo.FinalPayment;
                    }
                }
                else
                {
                    empty = orderInfo.PayOrderId;
                    d     = orderInfo.GetTotal(true);
                }
                goto IL_0309;
            }
            if (string.IsNullOrEmpty(text2))
            {
                this.litError.Text = "订单状态错误,不能进行支付!";
                return;
            }
            orderInfo = OrderHelper.GetOrderInfo(text2);
            if (orderInfo == null)
            {
                this.litError.Text = "订单状态错误,不能进行支付!";
                return;
            }
            if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                if (orderInfo.OrderSource == OrderSource.Alioh)
                {
                    base.Response.Redirect("/AliOH/MemberOrderDetails?OrderId=" + orderInfo.OrderId);
                }
                else
                {
                    base.Response.Redirect("/WapShop/MemberOrderDetails?OrderId=" + orderInfo.OrderId);
                }
                return;
            }
            empty             = text2;
            this.isFightGroup = ((orderInfo.FightGroupId > 0) ? "true" : "false");
            decimal d2 = default(decimal);

            if (orderInfo.PreSaleId > 0)
            {
                if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                {
                    empty = orderInfo.OrderId;
                    d2    = ((orderInfo.Deposit - orderInfo.BalanceAmount > decimal.Zero) ? (orderInfo.Deposit - orderInfo.BalanceAmount) : decimal.Zero);
                }
                if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (orderInfo.PayRandCode.ToInt(0) == 0)
                    {
                        int num2 = orderInfo.PayRandCode.ToInt(0);
                        num2 = ((num2 >= 100) ? (num2 + 1) : 100);
                        orderInfo.PayRandCode = num2.ToString();
                        OrderHelper.UpdateOrderPaymentTypeOfAPI(orderInfo);
                    }
                    empty = orderInfo.PayOrderId;
                    d2    = ((orderInfo.FinalPayment > decimal.Zero) ? orderInfo.FinalPayment : decimal.Zero);
                }
            }
            else
            {
                empty = orderInfo.PayOrderId;
                d2    = orderInfo.GetTotal(true);
            }
            packageInfo.Body      = orderInfo.OrderId;
            packageInfo.NotifyUrl = Globals.GetProtocal(HttpContext.Current) + "://" + $"{this.Page.Request.Url.Host}/pay/wx_Pay";
            if (orderInfo.OrderType != OrderType.ServiceOrder && orderInfo.OrderSource == OrderSource.Applet)
            {
                packageInfo.NotifyUrl = Globals.GetProtocal(HttpContext.Current) + "://" + $"{this.Page.Request.Url.Host}/pay/O2OApplet_Pay";
            }
            packageInfo.OutTradeNo = empty;
            packageInfo.Attach     = empty2;
            packageInfo.TotalFee   = (int)(d2 * 100m);
            if (packageInfo.TotalFee < decimal.One)
            {
                packageInfo.TotalFee = decimal.One;
            }
            goto IL_06db;
IL_06db:
            packageInfo.SpbillCreateIp = ((string.IsNullOrEmpty(text) || !Globals.IsIpAddress(text)) ? Globals.GetIPAddress(HttpContext.Current) : text);
            string text3      = masterSettings.WeixinAppId;
            string appSecret  = masterSettings.WeixinAppSecret;
            string text4      = masterSettings.WeixinPartnerID;
            string partnerKey = masterSettings.WeixinPartnerKey;
            string text5      = masterSettings.Main_Mch_ID;
            string text6      = masterSettings.Main_AppId;

            if (orderInfo.OrderType == OrderType.ServiceOrder)
            {
                text3      = masterSettings.O2OAppletAppId;
                appSecret  = masterSettings.O2OAppletAppSecrect;
                text4      = masterSettings.O2OAppletMchId;
                partnerKey = masterSettings.O2OAppletKey;
                text5      = "";
                text6      = "";
            }
            else if (orderInfo.OrderSource == OrderSource.Applet)
            {
                text3      = masterSettings.WxAppletAppId;
                appSecret  = masterSettings.WxAppletAppSecrect;
                text4      = masterSettings.WxApplectMchId;
                partnerKey = masterSettings.WxApplectKey;
                text5      = "";
                text6      = "";
            }
            string text7 = "";

            if (!string.IsNullOrEmpty(text6) && !string.IsNullOrEmpty(text5))
            {
                packageInfo.sub_openid = text7;
            }
            else
            {
                packageInfo.OpenId = text7;
            }
            PayClient payClient = null;

            payClient = ((string.IsNullOrEmpty(text6) || string.IsNullOrEmpty(text5)) ? new PayClient(text3, appSecret, text4, partnerKey, "", "", "", "") : new PayClient(text6, appSecret, text5, partnerKey, "", text4, text3, ""));
            Globals.AppendLog(JsonHelper.GetJson(packageInfo), "", "", "H5PaySubmit");
            PayRequestInfo payRequestInfo = payClient.BuildH5PayRequest(packageInfo);

            this.pay_uri = payRequestInfo.mweb_url;
            return;

IL_0309:
            packageInfo.Body       = text2;
            packageInfo.NotifyUrl  = Globals.GetProtocal(HttpContext.Current) + "://" + $"{this.Page.Request.Url.Host}/pay/AppStore_wxPay";
            packageInfo.OutTradeNo = empty;
            packageInfo.TotalFee   = (int)(d * 100m);
            if (orderInfo != null)
            {
                packageInfo.OutTradeNo = orderInfo.PayOrderId;
                packageInfo.Attach     = empty2;
            }
            else
            {
                packageInfo.OutTradeNo = empty;
                packageInfo.Attach     = empty2;
            }
            if (packageInfo.TotalFee < decimal.One)
            {
                packageInfo.TotalFee = decimal.One;
            }
            goto IL_06db;
        }
		protected void Page_Load(object sender, EventArgs e)
		{
			NameValueCollection nameValueCollection = new NameValueCollection
			{
				this.Page.Request.Form,
				this.Page.Request.QueryString
			};
			this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest";
			this.Notify = PaymentNotify.CreateInstance(this.Gateway, nameValueCollection);
			this.OrderId = this.Notify.GetOrderId();
			this.Order = ShoppingProcessor.GetOrderInfo(this.OrderId);
			this.offlineOrder = StoresHelper.GetStoreCollectionInfo(this.OrderId);
			if (this.Order == null && this.offlineOrder == null)
			{
				Globals.AppendLog(nameValueCollection, "通知信息为空", "", "", "AppStore_wxPay");
				base.Response.Write("success");
			}
			else
			{
				PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");
				if (paymentMode == null)
				{
					Globals.WriteLog(nameValueCollection, "支付方式获取失败hishop.plugins.payment.ws_wappay.wswappayrequest", "", "", "alipay");
					base.Response.Write("success");
				}
				else
				{
					this.Amount = this.Notify.GetOrderAmount();
					if (this.Order == null)
					{
						this.isOfflineOrder = true;
					}
					else
					{
						if (this.Amount <= decimal.Zero)
						{
							this.Amount = this.Order.GetTotal(true);
						}
						this.offlineOrder = StoresHelper.GetStoreCollectionInfoOfOrderId(this.OrderId);
						this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId();
						this.Order.PaymentType = paymentMode.Name;
						this.Order.PaymentTypeId = 2;
						this.Order.Gateway = paymentMode.Gateway;
						if (this.offlineOrder == null)
						{
							this.offlineOrder = StoresHelper.GetStoreCollectionInfoOfOrderId(this.Order.OrderId);
						}
					}
					if (this.offlineOrder != null)
					{
						if (this.Amount <= decimal.Zero)
						{
							this.Amount = this.offlineOrder.PayAmount;
						}
						this.offlineOrder.GateWayOrderId = this.Notify.GetGatewayOrderId();
						this.offlineOrder.PaymentTypeId = 2;
						this.offlineOrder.PaymentTypeName = paymentMode.Name;
						this.offlineOrder.GateWay = paymentMode.Gateway;
					}
					this.Notify.Finished += this.Notify_Finished;
					this.Notify.NotifyVerifyFaild += this.Notify_NotifyVerifyFaild;
					this.Notify.Payment += this.Notify_Payment;
					this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(paymentMode.Settings));
				}
			}
		}
        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";
                }
            }
        }
Exemple #26
0
        private void SaveStores(out int storeId)
        {
            storeId = 0;
            CreateStoreData createStoreData = new CreateStoreData();
            ManagerInfo     managerInfo     = new ManagerInfo();
            StoresInfo      storesInfo      = new StoresInfo();
            double          num             = 0.0;
            int             num2            = 0;
            int             num3            = 0;
            decimal         num4            = default(decimal);
            string          text            = "";
            string          text2           = "";
            string          Address         = "";
            string          userName        = DataHelper.CleanSearchString(this.txtUserName.Text.Trim());
            string          storeName       = Globals.StripAllTags(this.txtStoresName.Text.Trim());

            Address = Globals.StripAllTags(this.txtAddress.Text);
            string text3 = Globals.StripAllTags(this.txtRegionScop.Value.Trim());
            string text4 = Globals.StripAllTags(this.txtRegionScopName.Value.Trim());

            text  = this.txtTel.Text;
            text2 = Globals.StripAllTags(this.txtContactMan.Text);
            if (StoresHelper.ExistStoreName(storeName))
            {
                this.ResetForm();
                this.ShowMsg("门店名称已经存在,请重新输入!", false);
            }
            else if (Hidistro.SaleSystem.Store.ManagerHelper.FindManagerByUsername(userName) != null)
            {
                this.ResetForm();
                this.ShowMsg("用户名已经存在,请重新输入!", false);
            }
            else if (this.txtUserPwd.Text.Length < 6 || this.txtUserPwd.Text.Length > 20)
            {
                this.ResetForm();
                this.ShowMsg("密码不能为空!", false);
            }
            else if (string.Compare(this.txtUserPwd.Text, this.txtUserRePwd.Text) != 0)
            {
                this.ResetForm();
                this.ShowMsg("请确保两次输入的密码相同", false);
            }
            else if (!this.dropRegion.GetSelectedRegionId().HasValue)
            {
                this.ResetForm();
                this.ShowMsg("请选择店铺所在区域!", false);
            }
            else if (text2.Length > 8 || text2.Length < 2)
            {
                this.ResetForm();
                this.ShowMsg("请输入联系人,联系人长度必须是2-8位!", false);
            }
            else if (string.IsNullOrEmpty(this.hfLatitude.Value) || string.IsNullOrEmpty(this.hfLongitude.Value))
            {
                this.ResetForm();
                this.ShowMsg("请给门店标注定位!", false);
            }
            else if (text == "" || !DataHelper.IsTel(text))
            {
                this.ResetForm();
                this.ShowMsg("请输入正确的联系电话(手机或者固定电话)!", false);
            }
            else if (!this.chkIsSupportExpress.Checked && !this.chkIsAboveSelf.Checked && !this.chkIsStoreDelive.Checked)
            {
                this.ResetForm();
                this.ShowMsg("请选择一种配送方式!", false);
            }
            else
            {
                if (this.chkIsStoreDelive.Checked)
                {
                    if (!double.TryParse(this.txtServeRadius.Text.Trim(), out num) || num > 10000.0 || num <= 0.0)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的配送半径,为大于0至10000之间的数字!", false);
                        return;
                    }
                    if (!int.TryParse(this.txtStoreFreight.Text.Trim(), out num2) || num2 > 99999999 || num2 < 0)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的配送费", false);
                        return;
                    }
                    if (!int.TryParse(this.txtMinOrderPrice.Text.Trim(), out num3) || num3 > 99999999 || num3 < 0)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的起送价", false);
                        return;
                    }
                }
                if (!decimal.TryParse(this.txtCommissionRate.Text.Trim(), out num4) || num4 > 100m || num4 < decimal.Zero)
                {
                    this.ResetForm();
                    this.ShowMsg("请输入正确的平台抽佣比例", false);
                }
                else if (!this.chkOfflinePay.Checked && !this.chkOnlinePay.Checked && !this.chkCashOnDelivery.Checked)
                {
                    this.ResetForm();
                    this.ShowMsg("支付方式请至少选择一种", false);
                }
                else
                {
                    storesInfo.IsOfflinePay     = this.chkOfflinePay.Checked;
                    storesInfo.IsOnlinePay      = this.chkOnlinePay.Checked;
                    storesInfo.IsCashOnDelivery = this.chkCashOnDelivery.Checked;
                    if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartH.Text) || this.txtStoreOpenTimeStartH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartH.Text.ToInt(0) >= 24)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的营业起始小时", false);
                    }
                    else if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartM.Text) || this.txtStoreOpenTimeStartM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartM.Text.ToInt(0) >= 60)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的营业起始分钟", false);
                    }
                    else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndH.Text) || this.txtStoreOpenTimeEndH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndH.Text.ToInt(0) >= 24)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的营业结束小时", false);
                    }
                    else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndM.Text) || this.txtStoreOpenTimeEndM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndM.Text.ToInt(0) >= 60)
                    {
                        this.ResetForm();
                        this.ShowMsg("请输入正确的营业结束分钟", false);
                    }
                    else
                    {
                        string   empty     = string.Empty;
                        DateTime dateTime  = DateTime.Now;
                        string   text5     = dateTime.ToString("yyyy-MM-dd");
                        DateTime?nullable  = (text5 + " " + this.txtStoreOpenTimeStartH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeStartM.Text.ToInt(0)).ToDateTime();
                        DateTime?nullable2 = (text5 + " " + this.txtStoreOpenTimeEndH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeEndM.Text.ToInt(0)).ToDateTime();
                        dateTime = nullable.Value;
                        string str = dateTime.ToString("HH:mm");
                        dateTime = nullable2.Value;
                        string text6 = dateTime.ToString("HH:mm");
                        if (text6 == "00:00")
                        {
                            nullable2 = (text5 + " 23:59").ToDateTime();
                            text6     = "23:59";
                        }
                        empty = (storesInfo.StoreOpenTime = str + "-" + text6);
                        storesInfo.OpenStartDate    = nullable.Value;
                        storesInfo.OpenEndDate      = nullable2.Value;
                        storesInfo.IsSupportExpress = (this.chkIsSupportExpress.Checked && true);
                        storesInfo.IsAboveSelf      = (this.chkIsAboveSelf.Checked && true);
                        storesInfo.IsStoreDelive    = (this.chkIsStoreDelive.Checked && true);
                        storesInfo.Introduce        = this.editDescription.Text;
                        storesInfo.ServeRadius      = num;
                        if (this.chkIsStoreDelive.Checked)
                        {
                            storesInfo.MinOrderPrice = num3;
                            storesInfo.StoreFreight  = num2;
                        }
                        storesInfo.CommissionRate   = num4;
                        storesInfo.IsShelvesProduct = true;
                        storesInfo.IsModifyPrice    = true;
                        storesInfo.IsRequestBlance  = true;
                        storesInfo.MinPriceRate     = 0.5.ToDecimal(0);
                        storesInfo.MaxPriceRate     = 2;
                        string[] array  = text3.Split(',');
                        string[] array2 = text4.Split(',');
                        IDictionary <int, DeliveryScopeInfo> dictionary = new Dictionary <int, DeliveryScopeInfo>();
                        for (int i = 0; i < array.Length; i++)
                        {
                            int num5 = 0;
                            if (int.TryParse(array[i], out num5) && array2.Length >= i && dictionary != null && !dictionary.ContainsKey(num5))
                            {
                                DeliveryScopeInfo deliveryScopeInfo = new DeliveryScopeInfo();
                                deliveryScopeInfo.RegionId       = num5;
                                deliveryScopeInfo.RegionName     = array2[i];
                                deliveryScopeInfo.FullRegionPath = RegionHelper.GetFullPath(num5, true);
                                dictionary.Add(num5, deliveryScopeInfo);
                            }
                        }
                        managerInfo.RoleId   = -1;
                        managerInfo.UserName = this.txtUserName.Text.Trim();
                        string text8 = this.txtUserPwd.Text;
                        managerInfo.CreateDate = DateTime.Now;
                        string text9 = Globals.RndStr(128, true);
                        text8 = (managerInfo.Password = Users.EncodePassword(text8, text9));
                        managerInfo.PasswordSalt = text9;
                        storesInfo.StoreName     = storeName;
                        storesInfo.CloseStatus   = true;
                        storesInfo.State         = 1;
                        storesInfo.RegionId      = this.dropRegion.GetSelectedRegionId().Value;
                        storesInfo.TopRegionId   = RegionHelper.GetCityId(storesInfo.RegionId);
                        storesInfo.Tel           = text;
                        List <string> list = RegionHelper.GetFullRegion(this.dropRegion.GetSelectedRegionId().Value, ",", true, 0).Split(',').Take(3)
                                             .ToList();
                        list.ForEach(delegate(string c)
                        {
                            Address = Address.Replace(c, string.Empty);
                        });
                        storesInfo.Address    = Address;
                        storesInfo.ContactMan = text2;
                        IList <string> list2  = new List <string>();
                        string         text11 = this.hidUploadImages.Value.Trim();
                        string[]       array3 = text11.Split(',');
                        for (int j = 0; j < array3.Length; j++)
                        {
                            if (!string.IsNullOrEmpty(array3[j]))
                            {
                                string text12         = Globals.SaveFile("depot", array3[j], "/Storage/master/", true, false, "");
                                string sourceFilename = base.Request.MapPath(text12);
                                string virtualPath    = HiContext.Current.GetStoragePath() + "/depot/thum_" + text12.Substring(text12.LastIndexOf("/") + 1);
                                ResourcesHelper.CreateThumbnail(sourceFilename, base.Request.MapPath(virtualPath), 160, 160);
                                list2.Add(text12);
                            }
                        }
                        if (list2.Count == 0)
                        {
                            this.ResetForm();
                            this.ShowMsg("请上传门店logo", false);
                        }
                        else
                        {
                            storesInfo.StoreImages = ((list2.Count == 0) ? string.Empty : string.Join(",", list2.ToArray()));
                            if (!string.IsNullOrEmpty(this.hfLatitude.Value))
                            {
                                storesInfo.Latitude = double.Parse(this.hfLatitude.Value);
                            }
                            if (!string.IsNullOrEmpty(this.hfLongitude.Value))
                            {
                                storesInfo.Longitude = double.Parse(this.hfLongitude.Value);
                            }
                            storesInfo.FullRegionPath = RegionHelper.GetFullPath(storesInfo.RegionId, true);
                            storeId = StoresHelper.AddStore(storesInfo);
                            if (storeId > 0)
                            {
                                HiCache.Remove("DataCache-StoreInfoDataKey");
                                managerInfo.StoreId = storeId;
                                Hidistro.SaleSystem.Store.ManagerHelper.Create(managerInfo);
                                if (dictionary.Count > 0 && this.chkIsStoreDelive.Checked)
                                {
                                    StoresHelper.AddDeliveryScope(storeId, dictionary);
                                }
                                if (!string.IsNullOrEmpty(this.txtStoreTag.Text.Trim()))
                                {
                                    IList <int> list3  = new List <int>();
                                    string      text13 = this.txtStoreTag.Text.Trim();
                                    string[]    array4 = null;
                                    array4 = ((!text13.Contains(",")) ? new string[1]
                                    {
                                        text13
                                    } : text13.Split(','));
                                    string[] array5 = array4;
                                    foreach (string value in array5)
                                    {
                                        list3.Add(Convert.ToInt32(value));
                                    }
                                    StoresHelper.BindStoreTags(storeId, list3);
                                }
                                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                if (masterSettings.OpenDadaLogistics)
                                {
                                    DataTable dataTable = DepotHelper.SynchroDadaStoreList(storeId);
                                    if (dataTable != null && dataTable.Rows.Count > 0)
                                    {
                                        for (int l = 0; l < dataTable.Rows.Count; l++)
                                        {
                                            string station_name    = dataTable.Rows[l]["StoreName"].ToNullString();
                                            int    business        = 5;
                                            string city_name       = dataTable.Rows[l]["CityName"].ToNullString().Replace("市", "");
                                            string area_name       = dataTable.Rows[l]["RegionName"].ToNullString();
                                            string station_address = dataTable.Rows[l]["Address"].ToNullString();
                                            double lng             = dataTable.Rows[l]["Longitude"].ToDouble(0);
                                            double lat             = dataTable.Rows[l]["Latitude"].ToDouble(0);
                                            string contact_name    = dataTable.Rows[l]["ContactMan"].ToNullString();
                                            string phone           = dataTable.Rows[l]["Tel"].ToNullString();
                                            string origin_shop_id  = dataTable.Rows[l]["StoreId"].ToNullString();
                                            string text14          = DadaHelper.shopAdd(masterSettings.DadaSourceID, station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, origin_shop_id, "", "", "");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #27
0
        private void AddWXStore()
        {
            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings();
            StoresInfo      storeById       = StoresHelper.GetStoreById(this.storeId);
            IList <string>  list            = new List <string>();
            CreateStoreData createStoreData = new CreateStoreData();
            string          text            = this.hidUploadImages.Value.Trim();

            string[] array = text.Split(',');
            for (int i = 0; i < array.Length; i++)
            {
                if (!string.IsNullOrEmpty(array[i]))
                {
                    string item = Globals.SaveFile("depot", array[i], "/Storage/master/", true, false, "");
                    list.Add(item);
                }
            }
            IEnumerable <string> enumerable = WXStoreHelper.ImageUploadForStore(list);

            foreach (string item2 in enumerable)
            {
                createStoreData.business.base_info.photo_list.Add(new Store_Photo
                {
                    photo_url = item2
                });
            }
            string        address = this.txtWxAddress.Text.Trim();
            List <string> list2   = RegionHelper.GetFullRegion(storeById.RegionId, ",", true, 0).Split(',').Take(3)
                                    .ToList();

            list2.ForEach(delegate(string c)
            {
                address = address.Replace(c, string.Empty);
            });
            createStoreData.business.base_info.address       = address;
            createStoreData.business.base_info.avg_price     = this.txtWXAvgPrice.Text.ToInt(0);
            createStoreData.business.base_info.branch_name   = storeById.StoreName;
            createStoreData.business.base_info.business_name = masterSettings.SiteName;
            createStoreData.business.base_info.categories    = new string[1]
            {
                $"{this.ddlCategoryParent.SelectedValue.Trim()},{this.ddlCategoryChild.SelectedValue.Trim()}"
            };
            createStoreData.business.base_info.city         = list2[1];
            createStoreData.business.base_info.district     = this.hfDistrict.Value;
            createStoreData.business.base_info.introduction = this.txtWXIntroduction.Text.Trim();
            createStoreData.business.base_info.latitude     = this.hfLatitude.Value;
            createStoreData.business.base_info.longitude    = this.hfLongitude.Value;
            createStoreData.business.base_info.offset_type  = 1;
            createStoreData.business.base_info.open_time    = this.txtWXOpenTime.Text.Trim();
            createStoreData.business.base_info.province     = list2[0];
            createStoreData.business.base_info.recommend    = this.txtWXRecommend.Text.Trim();
            createStoreData.business.base_info.special      = this.txtWXSpecial.Text.Trim();
            createStoreData.business.base_info.telephone    = this.txtWXTelephone.Text.Trim();
            storeById.StoreImages = ((list.Count == 0) ? string.Empty : string.Join(",", list.ToArray()));
            createStoreData.business.base_info.sid = this.storeId.ToString();
            WxJsonResult wxJsonResult = WXStoreHelper.CreateWXStore(createStoreData);

            if (wxJsonResult.errcode.Equals(ReturnCode.请求成功))
            {
                StoresHelper.FirstAddWXStore(createStoreData, this.storeId, storeById.StoreImages);
            }
            this.ShowMsg("添加成功,等待微信审核", true, "StoresList.aspx");
        }
        public void SerachNearStore(HttpContext context)
        {
            string text  = Globals.UrlDecode(context.Request["fromLatLng"].ToNullString());
            string text2 = context.Request["changeStore"].ToNullString();
            int    num   = context.Request["storeSource"].ToInt(0);
            int    num2  = context.Request["storeId"].ToInt(0);

            context.Response.ContentType = "text/json";
            if (string.IsNullOrEmpty(text))
            {
                context.Response.Write("{\"Status\":\"noLatLng\",\"Message\":\"定位失败!\"}");
            }
            else
            {
                try
                {
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                    if (!masterSettings.OpenMultStore)
                    {
                        context.Response.Write("{\"Status\":\"platform\",\"Message\":\"进入平台页面!\"}");
                    }
                    else
                    {
                        DateTime now;
                        if ((num == 2 || num == 3 || num == 4) && num2 > 0)
                        {
                            string value = num2.ToString();
                            now = DateTime.Now;
                            WebHelper.SetCookie("UserCoordinateCookie", "StoreId", value, now.AddDays(10.0));
                            now = DateTime.Now;
                            WebHelper.SetCookie("UserCoordinateCookie", "StoreType", "2", now.AddDays(10.0));
                            string userCoordinateTimeCookieName = DepotHandler.UserCoordinateTimeCookieName;
                            now = DateTime.Now;
                            string value2 = now.ToString();
                            now = DateTime.Now;
                            WebHelper.SetCookie(userCoordinateTimeCookieName, value2, now.AddMinutes(10.0), null, true);
                        }
                        string store_PositionRouteTo = masterSettings.Store_PositionRouteTo;
                        text = text.Trim().Replace(" ", "");
                        MemberInfo user    = HiContext.Current.User;
                        int        num3    = WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "StoreType").ToInt(0);
                        int        num4    = WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "StoreId").ToInt(0);
                        string     cookie  = WebHelper.GetCookie(DepotHandler.UserCoordinateTimeCookieName);
                        string     cookie2 = WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Coordinate");
                        if (num4 > 0)
                        {
                            StoresInfo storeById = StoresHelper.GetStoreById(num4);
                            if (storeById == null || storeById.State == 0)
                            {
                                num4 = 0;
                            }
                        }
                        if (num2 > 0)
                        {
                            StoresInfo storeById2 = StoresHelper.GetStoreById(num2);
                            if (storeById2 == null || storeById2.State == 0)
                            {
                                num2 = 0;
                            }
                        }
                        if (num == 4 && num2 > 0)
                        {
                            DepotHelper.CookieUserCoordinate(text);
                            context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num2 + "\"}");
                        }
                        else if (num3 == 2 && num4 > 0 && num > 1 && !string.IsNullOrEmpty(cookie))
                        {
                            context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}");
                        }
                        else if (store_PositionRouteTo.Equals("NearestStore"))
                        {
                            if (!string.IsNullOrEmpty(cookie) && num3 == 2 && num4 > 0)
                            {
                                context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}");
                            }
                            else if (!string.IsNullOrEmpty(text2) && text2.Equals("0") && num4 > 0)
                            {
                                string userCoordinateTimeCookieName2 = DepotHandler.UserCoordinateTimeCookieName;
                                now = DateTime.Now;
                                string value3 = now.ToString();
                                now = DateTime.Now;
                                WebHelper.SetCookie(userCoordinateTimeCookieName2, value3, now.AddMinutes(10.0), null, true);
                                string userCoordinateCookieName = DepotHandler.UserCoordinateCookieName;
                                string value4 = text;
                                now = DateTime.Now;
                                WebHelper.SetCookie(userCoordinateCookieName, "NewCoordinate", value4, now.AddMinutes(10.0));
                                context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}");
                            }
                            else if (user != null && user.StoreId > 0 && masterSettings.Store_IsMemberVisitBelongStore)
                            {
                                DepotHelper.CookieUserCoordinate(text);
                                context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + user.StoreId + "\"}");
                            }
                            else if (!string.IsNullOrEmpty(cookie) && !string.IsNullOrEmpty(cookie2) && num4 > 0)
                            {
                                context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}");
                            }
                            else if (string.IsNullOrEmpty(cookie) && !string.IsNullOrEmpty(cookie2) && num4 > 0 && string.IsNullOrEmpty(text2))
                            {
                                string[]     array    = cookie2.Split(',');
                                PositionInfo degree   = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0));
                                string[]     array2   = text.Split(',');
                                PositionInfo degree2  = new PositionInfo(array2[0].ToDouble(0), array2[1].ToDouble(0));
                                double       distance = MapHelper.GetDistance(degree, degree2);
                                if (distance > 500.0)
                                {
                                    string text3 = "";
                                    string text4 = "";
                                    string text5 = "";
                                    string text6 = "";
                                    string text7 = "";
                                    DepotHelper.GetAddressByLatLng(text, ref text3, ref text4, ref text5, ref text6, ref text7);
                                    string text8 = HttpUtility.UrlEncode(string.IsNullOrWhiteSpace(text3) ? text7 : text3);
                                    context.Response.Write("{\"Status\":\"tipChange\",\"Message\":\"提示切换!\",\"Addr\":\"" + text8 + "\",\"fromLatLng\":\"" + text + "\"}");
                                }
                                else
                                {
                                    string userCoordinateTimeCookieName3 = DepotHandler.UserCoordinateTimeCookieName;
                                    now = DateTime.Now;
                                    string value5 = now.ToString();
                                    now = DateTime.Now;
                                    WebHelper.SetCookie(userCoordinateTimeCookieName3, value5, now.AddMinutes(10.0), null, true);
                                    string userCoordinateCookieName2 = DepotHandler.UserCoordinateCookieName;
                                    string value6 = text;
                                    now = DateTime.Now;
                                    WebHelper.SetCookie(userCoordinateCookieName2, "NewCoordinate", value6, now.AddMinutes(10.0));
                                    context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}");
                                }
                            }
                            else
                            {
                                StoresInfo nearDeliveStores = DepotHelper.GetNearDeliveStores(text, false);
                                if (nearDeliveStores == null || nearDeliveStores.StoreId <= 0)
                                {
                                    string store_PositionNoMatchTo = masterSettings.Store_PositionNoMatchTo;
                                    if (store_PositionNoMatchTo == "Platform")
                                    {
                                        context.Response.Write("{\"Status\":\"noStoreToPlatform\",\"Message\":\"进入平台页面!\"}");
                                    }
                                    else
                                    {
                                        context.Response.Write("{\"Status\":\"nothing\",\"Message\":\"进入无平台提示页面!\"}");
                                    }
                                }
                                else
                                {
                                    context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + nearDeliveStores.StoreId + "\"}");
                                }
                            }
                        }
                        else if (store_PositionRouteTo.Equals("StoreList"))
                        {
                            if (!string.IsNullOrEmpty(text2) && text2.Equals("0"))
                            {
                                string userCoordinateTimeCookieName4 = DepotHandler.UserCoordinateTimeCookieName;
                                now = DateTime.Now;
                                string value7 = now.ToString();
                                now = DateTime.Now;
                                WebHelper.SetCookie(userCoordinateTimeCookieName4, value7, now.AddMinutes(10.0), null, true);
                                string userCoordinateCookieName3 = DepotHandler.UserCoordinateCookieName;
                                string value8 = text;
                                now = DateTime.Now;
                                WebHelper.SetCookie(userCoordinateCookieName3, "NewCoordinate", value8, now.AddMinutes(10.0));
                                context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Address") + "\",\"Message\":\"进入多门店首页!\"}");
                            }
                            else if (!string.IsNullOrEmpty(text2) && text2.Equals("1"))
                            {
                                string userCoordinateTimeCookieName5 = DepotHandler.UserCoordinateTimeCookieName;
                                now = DateTime.Now;
                                string value9 = now.ToString();
                                now = DateTime.Now;
                                WebHelper.SetCookie(userCoordinateTimeCookieName5, value9, now.AddMinutes(10.0), null, true);
                                string str = DepotHelper.CookieUserCoordinate(text);
                                context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + str + "\",\"Message\":\"进入多门店首页!\"}");
                            }
                            else if (string.IsNullOrEmpty(cookie) && !string.IsNullOrEmpty(cookie2) && string.IsNullOrEmpty(text2))
                            {
                                string[]     array3    = cookie2.Split(',');
                                PositionInfo degree3   = new PositionInfo(array3[0].ToDouble(0), array3[1].ToDouble(0));
                                string[]     array4    = text.Split(',');
                                PositionInfo degree4   = new PositionInfo(array4[0].ToDouble(0), array4[1].ToDouble(0));
                                double       distance2 = MapHelper.GetDistance(degree3, degree4);
                                if (distance2 > 500.0)
                                {
                                    string text9  = "";
                                    string text10 = "";
                                    string text11 = "";
                                    string text12 = "";
                                    string text13 = "";
                                    DepotHelper.GetAddressByLatLng(text, ref text9, ref text10, ref text11, ref text12, ref text13);
                                    string text14 = HttpUtility.UrlEncode(string.IsNullOrWhiteSpace(text9) ? text13 : text9);
                                    context.Response.Write("{\"Status\":\"tipChange\",\"Message\":\"提示切换!\",\"Addr\":\"" + text14 + "\",\"fromLatLng\":\"" + text + "\"}");
                                }
                                else
                                {
                                    string userCoordinateTimeCookieName6 = DepotHandler.UserCoordinateTimeCookieName;
                                    now = DateTime.Now;
                                    string value10 = now.ToString();
                                    now = DateTime.Now;
                                    WebHelper.SetCookie(userCoordinateTimeCookieName6, value10, now.AddMinutes(10.0), null, true);
                                    string userCoordinateCookieName4 = DepotHandler.UserCoordinateCookieName;
                                    string value11 = text;
                                    now = DateTime.Now;
                                    WebHelper.SetCookie(userCoordinateCookieName4, "NewCoordinate", value11, now.AddDays(10.0));
                                    context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Address") + "\",\"Message\":\"进入多门店首页!\"}");
                                }
                            }
                            else if (string.IsNullOrEmpty(cookie2))
                            {
                                string userCoordinateTimeCookieName7 = DepotHandler.UserCoordinateTimeCookieName;
                                now = DateTime.Now;
                                string value12 = now.ToString();
                                now = DateTime.Now;
                                WebHelper.SetCookie(userCoordinateTimeCookieName7, value12, now.AddMinutes(10.0), null, true);
                                string str2 = DepotHelper.CookieUserCoordinate(text);
                                context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + str2 + "\",\"Message\":\"进入多门店首页!\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Address") + "\",\"Message\":\"进入多门店首页!\"}");
                            }
                        }
                        else if (store_PositionRouteTo.Equals("Platform"))
                        {
                            if (string.IsNullOrEmpty(cookie2) || string.IsNullOrEmpty(cookie))
                            {
                                DepotHelper.CookieUserCoordinate(text);
                            }
                            if (user != null && user.StoreId > 0 && masterSettings.Store_IsMemberVisitBelongStore)
                            {
                                context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + user.StoreId + "\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"Status\":\"platform\",\"Addr\":\"" + WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Address") + "\",\"Message\":\"进入平台页面!\"}");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    context.Response.Write("{\"Status\":\"error\",\"Message\":\"" + ex.Message + "\"}");
                }
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string text = context.Request["action"].ToNullString();

            if (string.IsNullOrEmpty(text) || text == "")
            {
                string text2 = string.Empty;
                string text3 = context.Request["ckids"];
                if (!string.IsNullOrEmpty(text3))
                {
                    text2 = text3;
                }
                string           a2 = context.Request["client"].ToNullString();
                ShoppingCartInfo shoppingCartInfo = (!(a2 == "wap")) ? ShoppingCartProcessor.GetShoppingCart(text2, false, false, -1) : ShoppingCartProcessor.GetMobileShoppingCart(text2, false, false, -1);
                if (shoppingCartInfo != null)
                {
                    string[] source = text2.Split(',');
                    bool     flag   = false;
                    bool     flag2  = true;
                    bool     flag3  = true;
                    foreach (ShoppingCartItemInfo lineItem in shoppingCartInfo.LineItems)
                    {
                        if (source.Contains(lineItem.SkuId) || source.Contains(lineItem.SkuId + "|" + lineItem.StoreId))
                        {
                            int skuStock = ShoppingCartProcessor.GetSkuStock(lineItem.SkuId, lineItem.StoreId);
                            if (skuStock < lineItem.Quantity)
                            {
                                flag = true;
                                break;
                            }
                            if (HiContext.Current.SiteSettings.OpenMultStore && lineItem.StoreId > 0)
                            {
                                StoresInfo storeById = StoresHelper.GetStoreById(lineItem.StoreId);
                                if (storeById != null)
                                {
                                    if (!SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                                    {
                                        DateTime dateTime = DateTime.Now;
                                        string   str      = dateTime.ToString("yyyy-MM-dd");
                                        dateTime = storeById.OpenStartDate;
                                        DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                                        dateTime = DateTime.Now;
                                        string str2 = dateTime.ToString("yyyy-MM-dd");
                                        dateTime = storeById.OpenEndDate;
                                        DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                                        if (dateTime2 <= value)
                                        {
                                            dateTime2 = dateTime2.AddDays(1.0);
                                        }
                                        if (DateTime.Now < value || DateTime.Now > dateTime2)
                                        {
                                            flag3 = false;
                                        }
                                    }
                                    if (!storeById.CloseStatus && storeById.CloseEndTime.HasValue && storeById.CloseBeginTime.HasValue && storeById.CloseEndTime.Value > DateTime.Now && storeById.CloseBeginTime.Value < DateTime.Now)
                                    {
                                        flag2 = false;
                                    }
                                }
                            }
                        }
                    }
                    if (flag)
                    {
                        context.Response.ContentType = "text/json";
                        context.Response.Write("{\"status\":\"false\",\"msg\":\"有商品库存不足,不能结算\"}");
                        context.Response.End();
                    }
                    if (!flag3)
                    {
                        context.Response.ContentType = "text/json";
                        context.Response.Write("{\"status\":\"StoreNotInTime\",\"msg\":\"非营业时间\"}");
                        context.Response.End();
                    }
                    if (!flag2)
                    {
                        context.Response.ContentType = "text/json";
                        context.Response.Write("{\"status\":\"StoreNotOpen\",\"msg\":\"歇业中\"}");
                        context.Response.End();
                    }
                    if (shoppingCartInfo != null)
                    {
                        ShoppingCartGiftInfo shoppingCartGiftInfo = (from a in shoppingCartInfo.LineGifts
                                                                     where a.PromoType == 5
                                                                     select a).FirstOrDefault();
                        shoppingCartInfo.SendGiftPromotionId = (shoppingCartGiftInfo?.GiftId ?? 0);
                        if (!shoppingCartInfo.IsSendGift && shoppingCartInfo.LineGifts.Count > 0)
                        {
                            foreach (ShoppingCartGiftInfo lineGift in shoppingCartInfo.LineGifts)
                            {
                                ShoppingCartProcessor.RemoveGiftItem(lineGift.GiftId, PromoteType.SentGift);
                            }
                        }
                    }
                    string s = JsonConvert.SerializeObject(shoppingCartInfo);
                    context.Response.ContentType = "text/json";
                    context.Response.Write(s);
                }
            }
            else if (text == "ClearCart")
            {
                string text4 = context.Request.Form["ck_productId"].ToNullString();
                if (string.IsNullOrEmpty(text4))
                {
                    context.Response.Write("{\"status\":\"false\",\"msg\":\"请选择要清除的商品\"}");
                }
                else
                {
                    string[] array = text4.Split(',');
                    foreach (string text5 in array)
                    {
                        string[] array2 = text5.Split('|');
                        if (array2.Length == 2)
                        {
                            ShoppingCartProcessor.RemoveLineItem(array2[0], array2[1].ToInt(0));
                        }
                        else
                        {
                            ShoppingCartProcessor.RemoveLineItem(text5, 0);
                        }
                    }
                    context.Response.Write("{\"status\":\"true\",\"msg\":\"清除成功\"}");
                }
                context.Response.End();
            }
            else if (text == "HasStore")
            {
                string       text6          = context.Request.Form["skuId"].ToNullString();
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                if (string.IsNullOrEmpty(text6) || !masterSettings.OpenMultStore)
                {
                    context.Response.Write("{\"status\":\"false\"}");
                }
                else if (ShoppingCartProcessor.HasStoreSkuStocks(text6))
                {
                    context.Response.Write("{\"status\":\"true\"}");
                }
                else
                {
                    context.Response.Write("{\"status\":\"false\"}");
                }
            }
            else if (text == "ProductsHasStore")
            {
                string       text7           = context.Request.Form["productIds"];
                SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
                if (string.IsNullOrEmpty(text7) || !masterSettings2.OpenMultStore)
                {
                    context.Response.Write("{\"status\":\"false\"}");
                }
                else
                {
                    string str3 = ShoppingCartProcessor.HasStoreByProducts(text7);
                    context.Response.Write("{\"status\":\"true\",\"productIds\":\"" + str3 + "\"}");
                }
            }
            else if (text == "updateBuyNum")
            {
                string               skuid                = context.Request.Form["SkuId"].ToNullString().Trim();
                int                  num                  = context.Request.Form["BuyNum"].ToNullString().Trim().ToInt(0);
                string               a3                   = context.Request.Form["client"].ToNullString().Trim();
                ShoppingCartInfo     shoppingCartInfo2    = (!(a3 == "wap")) ? ShoppingCartProcessor.GetShoppingCart(null, false, false, -1) : ShoppingCartProcessor.GetMobileShoppingCart(null, false, false, -1);
                ShoppingCartItemInfo shoppingCartItemInfo = shoppingCartInfo2.LineItems.FirstOrDefault((ShoppingCartItemInfo a) => a.SkuId == skuid);
                int                  num2                 = shoppingCartItemInfo?.Quantity ?? 1;
                if (num <= 0)
                {
                    context.Response.Write("{\"status\":\"numError\",\"msg\":\"购买数量必须为大于0的整数\",\"oldNumb\":\"" + num2 + "\"}");
                }
                else if (ShoppingCartProcessor.GetSkuStock(skuid, 0) < num)
                {
                    context.Response.Write("{\"status\":\"StockError\",\"msg\":\"该商品库存不足\",\"oldNumb\":\"" + num2 + "\"}");
                }
                else
                {
                    ShoppingCartProcessor.UpdateLineItemQuantity(skuid, num, 0);
                    PromotionInfo productQuantityDiscountPromotion = ShoppingCartProcessor.GetProductQuantityDiscountPromotion(skuid, HiContext.Current.User.GradeId);
                    if (productQuantityDiscountPromotion != null && (decimal)num >= productQuantityDiscountPromotion.Condition)
                    {
                        shoppingCartItemInfo.AdjustedPrice = shoppingCartItemInfo.MemberPrice * productQuantityDiscountPromotion.DiscountValue;
                    }
                    else
                    {
                        shoppingCartItemInfo.AdjustedPrice = shoppingCartItemInfo.MemberPrice;
                    }
                    context.Response.Write("{\"status\":\"true\",\"adjustedPrice\":" + shoppingCartItemInfo.AdjustedPrice.F2ToString("f2") + "}");
                }
            }
            else if (text == "updateGiftBuyNum")
            {
                string               giftId                = context.Request.Form["giftId"].ToNullString().Trim();
                int                  num3                  = context.Request.Form["BuyNum"].ToNullString().Trim().ToInt(0);
                string               a4                    = context.Request.Form["client"].ToNullString().Trim();
                ShoppingCartInfo     shoppingCartInfo3     = (!(a4 == "wap")) ? ShoppingCartProcessor.GetShoppingCart(null, false, false, -1) : ShoppingCartProcessor.GetMobileShoppingCart(null, false, false, -1);
                ShoppingCartGiftInfo shoppingCartGiftInfo2 = shoppingCartInfo3.LineGifts.FirstOrDefault((ShoppingCartGiftInfo a) => a.GiftId == giftId.ToInt(0));
                if (shoppingCartGiftInfo2 == null)
                {
                    context.Response.Write("{\"status\":\"nullError\",\"msg\":\"该礼品不存在或已删除\",\"oldNumb\":\"" + 0 + "\"}");
                }
                else if (num3 <= 0)
                {
                    context.Response.Write("{\"status\":\"numError\",\"msg\":\"购买数量必须为大于0的整数\",\"oldNumb\":\"" + shoppingCartGiftInfo2.Quantity + "\"}");
                }
                else
                {
                    ShoppingCartProcessor.UpdateGiftItemQuantity(giftId.ToInt(0), num3, PromoteType.NotSet);
                    context.Response.Write("{\"status\":\"true\"}");
                }
            }
            else if (text == "deleteGift")
            {
                string text8 = context.Request.Form["giftId"].ToNullString().Trim();
                text8 = text8.TrimStart(',').TrimEnd(',');
                string[] array3 = text8.Split(',');
                foreach (string text9 in array3)
                {
                    ShoppingCartProcessor.RemoveGiftItem(text8.ToInt(0), PromoteType.NotSet);
                }
                context.Response.Write("{\"status\":\"true\"}");
            }
            else if (text == "deletestore")
            {
                string skuId   = context.Request.Form["SkuId"].ToNullString().Trim();
                int    storeId = context.Request.Form["StoreId"].ToInt(0);
                ShoppingCartProcessor.RemoveLineItem(skuId, storeId);
                context.Response.Write("{\"status\":\"true\"}");
            }
            else if (text == "delete")
            {
                string skuId2 = context.Request.Form["SkuId"].ToNullString().Trim();
                ShoppingCartProcessor.RemoveLineItem(skuId2, 0);
                context.Response.Write("{\"status\":\"true\"}");
            }
            else if (text == "deleteall")
            {
                string text10 = context.Request.Form["SkuIdList"].ToNullString().Trim();
                if (!string.IsNullOrEmpty(text10.ToNullString().Trim()))
                {
                    text10 = text10.TrimStart(',').TrimEnd(',');
                    string[] array4 = text10.Split(',');
                    foreach (string skuId3 in array4)
                    {
                        ShoppingCartProcessor.RemoveLineItem(skuId3, 0);
                    }
                }
                context.Response.Write("{\"status\":\"true\"}");
            }
            else if (text == "reducedpromotion")
            {
                decimal       amount           = context.Request.Form["Amount"].ToDecimal(0);
                int           quantity         = context.Request.Form["Quantity"].ToInt(0);
                MemberInfo    user             = HiContext.Current.User;
                decimal       num4             = default(decimal);
                PromotionInfo reducedPromotion = new PromotionDao().GetReducedPromotion(user.GradeId, amount, quantity, out num4, 0);
                if (reducedPromotion != null)
                {
                    context.Response.Write("{\"ReducedPromotionAmount\":\"" + num4 + "\",\"ReducedPromotionCondition\":\"" + reducedPromotion.Condition + "\"}");
                }
                else
                {
                    context.Response.Write("{\"ReducedPromotionAmount\":\"0\",\"ReducedPromotionCondition\":\"0\"}");
                }
            }
        }
Exemple #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.hidBaseURL.Value = Globals.HostPath(base.Request.Url);
            string  text    = this.Page.Request.QueryString["orderId"];
            Literal literal = this.FindControl("litLogisiticType") as Literal;
            int     num     = 0;

            int.TryParse(this.Page.Request.QueryString["returnsId"], out num);
            int num2 = 0;

            int.TryParse(this.Page.Request.QueryString["replaceId"], out num2);
            string      text2       = "";
            string      text3       = "";
            string      text4       = "";
            string      text5       = "";
            string      text6       = "";
            string      text7       = "";
            bool        flag        = false;
            ReturnInfo  returnInfo  = null;
            ReplaceInfo replaceInfo = null;

            if (num > 0)
            {
                returnInfo = TradeHelper.GetReturnInfo(num);
            }
            if (num2 > 0)
            {
                replaceInfo = TradeHelper.GetReplaceInfo(num2);
            }
            OrderInfo orderInfo = null;

            if (!string.IsNullOrEmpty(text))
            {
                orderInfo = ShoppingProcessor.GetOrderInfo(text);
                if (orderInfo != null && orderInfo.ExpressCompanyName == "同城物流配送")
                {
                    this.hidIsShowDadaGIS.Value = "1";
                }
                if (orderInfo != null && !string.IsNullOrWhiteSpace(orderInfo.LatLng))
                {
                    this.hidUserLatlng.Value = orderInfo.LatLng;
                }
                else if (orderInfo != null && orderInfo.ShippingId > 0)
                {
                    ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId);
                    if (shippingAddress != null && !string.IsNullOrWhiteSpace(shippingAddress.LatLng))
                    {
                        this.hidUserLatlng.Value = shippingAddress.LatLng;
                    }
                }
                if (orderInfo != null)
                {
                    if (orderInfo.StoreId > 0)
                    {
                        StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId);
                        if (storeById != null && !string.IsNullOrWhiteSpace(storeById.LatLng))
                        {
                            this.hidStoreLatlng.Value = storeById.LatLng;
                        }
                    }
                    else
                    {
                        ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0);
                        if (defaultOrFirstShipper != null)
                        {
                            this.hidStoreLatlng.Value = defaultOrFirstShipper.Latitude + "," + defaultOrFirstShipper.Longitude;
                        }
                    }
                }
            }
            int num3;

            if (returnInfo != null)
            {
                if (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned)
                {
                    text2 = returnInfo.ExpressCompanyName;
                    text3 = returnInfo.ShipOrderNumber;
                    text4 = returnInfo.AdminShipTo;
                    text5 = returnInfo.AdminCellPhone;
                    text6 = returnInfo.AdminShipAddress;
                    text7 = returnInfo.ExpressCompanyAbb;
                    flag  = true;
                }
            }
            else if (replaceInfo != null)
            {
                if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery)
                {
                    this.hidReplaceType.Value = "User";
                    text2 = replaceInfo.UserExpressCompanyName;
                    text3 = replaceInfo.UserShipOrderNumber;
                    text4 = replaceInfo.AdminShipTo;
                    text5 = replaceInfo.AdminCellPhone;
                    text6 = replaceInfo.AdminShipAddress;
                    text7 = replaceInfo.ExpressCompanyAbb;
                    flag  = true;
                }
                else if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced)
                {
                    this.hidReplaceType.Value = "Mall";
                    text2 = replaceInfo.ExpressCompanyName;
                    text3 = replaceInfo.ShipOrderNumber;
                    text4 = orderInfo.ShipTo;
                    text5 = (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone);
                    text6 = orderInfo.ShippingRegion + "   " + orderInfo.Address;
                    text7 = orderInfo.ExpressCompanyAbb;
                }
                else
                {
                    this.LogisticsInfoPanel.InnerHtml = "商家还未发货";
                }
            }
            else if (orderInfo != null)
            {
                if ((orderInfo.OrderStatus == OrderStatus.SellerAlreadySent || orderInfo.OrderStatus == OrderStatus.Finished || (!string.IsNullOrEmpty(orderInfo.ExpressCompanyName) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber))) && orderInfo.ItemStatus != OrderItemStatus.HasReturnOrReplace)
                {
                    num3 = ((orderInfo.ShippingModeId != -2) ? 1 : 0);
                    goto IL_0456;
                }
                num3 = 0;
                goto IL_0456;
            }
            goto IL_0778;
IL_0778:
            if (flag)
            {
                this.hidOrderId.Value           = ((orderInfo != null) ? orderInfo.OrderId : string.Empty);
                this.ltlExpressCompanyName.Text = (text2.Equals("店员配送") ? "店员配送" : (text2 + ":"));
                this.ltlShipOrderNumber.Text    = text3;
                this.divlogisticsInfo.Visible   = !text2.Equals("店员配送");
                this.ltlReceiveName.Text        = text4;
                this.ltlTel.Text         = text5;
                this.ltlShipAddress.Text = text6;
                if (!string.IsNullOrEmpty(text3))
                {
                    string text8 = HttpContext.Current.Request.Url.ToString().ToLower();
                    if (text8.IndexOf("/wapshop/") != -1)
                    {
                        if (text7.ToLower() == "sf")
                        {
                            this.hylExpress100Search.NavigateUrl = $"http://www.sf-express.com/mobile/cn/sc/dynamic_function/waybill/waybill_query_info.html?billno={text3}";
                            this.hylExpress100Search.Text        = "顺丰官网查询>";
                        }
                        else
                        {
                            this.hylExpress100Search.NavigateUrl = $"https://m.kuaidi100.com/result.jsp?nu={text3}";
                        }
                    }
                    else if (text7.ToLower() == "sf")
                    {
                        this.hylExpress100Search.NavigateUrl = $"http://www.sf-express.com/mobile/cn/sc/dynamic_function/waybill/waybill_query_info.html?billno={text3}";
                        this.hylExpress100Search.Text        = "顺丰官网查询>";
                    }
                    else
                    {
                        this.hylExpress100Search.NavigateUrl = $"https://www.kuaidi100.com/chaxun?nu={text3}";
                    }
                }
                else
                {
                    this.ulExpress.Visible = false;
                }
            }
            return;

IL_0456:
            if (num3 != 0)
            {
                flag  = true;
                text2 = ((orderInfo.ExpressCompanyName != null) ? orderInfo.ExpressCompanyName : "");
                text3 = orderInfo.ShipOrderNumber;
                text4 = orderInfo.ShipTo;
                text5 = (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone);
                text6 = orderInfo.ShippingRegion + "   " + orderInfo.Address;
                text7 = orderInfo.ExpressCompanyAbb;
            }
            else if (orderInfo.ItemStatus == OrderItemStatus.HasReturn)
            {
                returnInfo = TradeHelper.GetReturnInfo(orderInfo.OrderId, "");
                if (returnInfo == null)
                {
                    foreach (LineItemInfo value in orderInfo.LineItems.Values)
                    {
                        if (value.ReturnInfo != null)
                        {
                            returnInfo = value.ReturnInfo;
                            break;
                        }
                    }
                }
                if (returnInfo != null && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned))
                {
                    text2 = returnInfo.ExpressCompanyName;
                    text3 = returnInfo.ShipOrderNumber;
                    text4 = returnInfo.AdminShipTo;
                    text5 = returnInfo.AdminCellPhone;
                    text6 = returnInfo.AdminShipAddress;
                    text7 = returnInfo.ExpressCompanyAbb;
                    flag  = true;
                }
            }
            else if (orderInfo.ItemStatus == OrderItemStatus.HasReplace)
            {
                replaceInfo = TradeHelper.GetReplaceInfo(orderInfo.OrderId, "");
                orderInfo   = ShoppingProcessor.GetOrderInfo(replaceInfo.OrderId);
                if (orderInfo == null)
                {
                    foreach (LineItemInfo value2 in orderInfo.LineItems.Values)
                    {
                        if (value2.ReplaceInfo != null)
                        {
                            replaceInfo = value2.ReplaceInfo;
                            break;
                        }
                    }
                }
                if (replaceInfo != null)
                {
                    if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery)
                    {
                        this.hidReplaceType.Value = "User";
                        text2 = replaceInfo.UserExpressCompanyName;
                        text3 = replaceInfo.UserShipOrderNumber;
                        text4 = replaceInfo.AdminShipTo;
                        text5 = replaceInfo.AdminCellPhone;
                        text6 = replaceInfo.AdminShipAddress;
                        text7 = replaceInfo.ExpressCompanyAbb;
                        flag  = true;
                    }
                    if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced)
                    {
                        this.hidReplaceType.Value = "Mall";
                        text2 = replaceInfo.ExpressCompanyName;
                        text3 = replaceInfo.ShipOrderNumber;
                        text4 = orderInfo.ShipTo;
                        text5 = (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone);
                        text6 = orderInfo.ShippingRegion + "   " + orderInfo.Address;
                        text7 = orderInfo.ExpressCompanyAbb;
                    }
                    else
                    {
                        this.LogisticsInfoPanel.InnerHtml = "商家还未发货";
                    }
                }
            }
            goto IL_0778;
        }