示例#1
0
        private void ChangeOrderStore(HttpContext context)
        {
            string orderId = context.Request["orderId"].ToString();
            int    num     = context.Request["storeId"].ToInt(0);
            int    num2    = context.Request["isGetStore"].ToInt(0);
            string text    = "";
            bool   flag    = StoresHelper.ChangeOrderStore(orderId, num, out text);

            if (num > 0 & flag)
            {
                if (num2 == 1)
                {
                    VShopHelper.AppPsuhRecordForStore(num, orderId, "", EnumPushStoreAction.TakeOnStoreOrderWaitConfirm);
                }
                else
                {
                    VShopHelper.AppPsuhRecordForStore(num, orderId, "", EnumPushStoreAction.StoreOrderWaitSendGoods);
                }
            }
            if (num2 != 1)
            {
                ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0);
                StoresInfo   storeById             = StoresHelper.GetStoreById(num);
                OrderInfo    orderInfo             = OrderHelper.GetOrderInfo(orderId);
                Messenger.OrderPaymentToShipper(defaultOrFirstShipper, storeById, null, orderInfo, orderInfo.GetTotal(false));
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write("{\"state\":" + (flag ? "1" : "0") + ",\"message\": \"" + text + "\"}");
        }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId);
         if (storeById != null)
         {
             if (!storeById.IsModifyPrice)
             {
                 base.GotoResourceNotFound();
             }
             else
             {
                 decimal?maxPriceRate = storeById.MaxPriceRate;
                 if (maxPriceRate.GetValueOrDefault() > default(decimal) && maxPriceRate.HasValue)
                 {
                     this.priceTip.Visible       = true;
                     this.hidIsModifyPrice.Value = "1";
                     this.priceTipMessage.Text   = $"可设置价格区间为商品价格的{storeById.MinPriceRate.ToNullString()}倍-{storeById.MaxPriceRate.ToNullString()}倍";
                     this.hidMinPriceRate.Value  = storeById.MinPriceRate.ToNullString();
                     this.hidMaxPriceRate.Value  = storeById.MaxPriceRate.ToNullString();
                 }
                 this.BindProduct();
             }
         }
         else
         {
             base.GotoResourceNotFound();
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         OrderInfo orderInfo = OrderHelper.GetOrderInfo(base.Request.QueryString["orderId"].ToNullString());
         if (orderInfo != null)
         {
             this.dropRegion.SetSelectedRegionId(orderInfo.RegionId);
             this.hidOrderId.Value = orderInfo.PayOrderId;
             if (orderInfo.StoreId == -1)
             {
                 this.ltlStore.Text = "无结果";
             }
             else if (orderInfo.StoreId == 0)
             {
                 this.ltlStore.Text = "平台";
             }
             else if (orderInfo.StoreId > 0)
             {
                 StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId);
                 this.ltlStore.Text = ((storeById == null) ? "该门店不存在或者已被删除" : storeById.StoreName);
             }
             this.hidIsGetStore.Value = ((orderInfo.ShippingModeId == -2) ? "1" : "");
         }
     }
 }
示例#4
0
        private void CreateQRCode()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            StoresInfo   storeById      = StoresHelper.GetStoreById(this.storeId);

            if (storeById == null)
            {
                this.ShowMsg("门店不存在", false, "BindHiPOS.aspx");
            }
            else
            {
                this.ltStoreName.Text = storeById.StoreName;
                string         storeHiPOSLastAlias = ManagerHelper.GetStoreHiPOSLastAlias();
                HiPOSHelper    hiPOSHelper         = new HiPOSHelper();
                AuthCodeResult authCode            = hiPOSHelper.GetAuthCode(masterSettings.HiPOSAppId, masterSettings.HiPOSMerchantId, storeById.StoreName);
                if (authCode.error == null)
                {
                    this.Url = authCode.merchant_authcode_response.qr;
                }
                else
                {
                    this.ShowMsg(authCode.error.message, false);
                }
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.hidStoreId.Value = HiContext.Current.Manager.StoreId.ToString();
            StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId);

            if (storeById != null)
            {
                if (!storeById.IsModifyPrice)
                {
                    this.spbacthSalePrice.Visible = false;
                    this.hidIsModifyPrice.Value   = "0";
                }
                if (!storeById.IsShelvesProduct)
                {
                    this.hidIsShelvesProduct.Value = "1";
                }
            }
            else
            {
                this.spbacthSalePrice.Visible    = false;
                this.spbacthStock.Visible        = false;
                this.spbacthWarningStock.Visible = false;
            }
            this.dropCategories.DataBind();
            this.LoadParameters();
        }
示例#6
0
        private string GetStoreName(int id)
        {
            StoresInfo storeById = StoresHelper.GetStoreById(id);

            if (storeById != null)
            {
                return(storeById.StoreName);
            }
            return(string.Empty);
        }
示例#7
0
        public void SetStoreState(HttpContext context)
        {
            int        value     = base.GetIntParam(context, "StoreId", false).Value;
            StoresInfo storeById = StoresHelper.GetStoreById(value);

            if (storeById == null)
            {
                throw new HidistroAshxException("错误的参数" + value);
            }
            storeById.State = ((storeById.State != 1) ? 1 : 0);
            StoresHelper.UpdateStore(storeById);
            HiCache.Remove("DataCache-StoreInfoDataKey");
            base.ReturnSuccessResult(context, "设置门店状态成功", 0, true);
        }
示例#8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId);
         if (storeById == null)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             this.BindProduct();
         }
     }
 }
示例#9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         int storeId = HiContext.Current.Manager.StoreId;
         this.IsShelvesProduct = false;
         StoresInfo storeById = StoresHelper.GetStoreById(storeId);
         if (storeById != null && storeById.IsShelvesProduct)
         {
             this.IsShelvesProduct = true;
         }
         this.dropCategories.DataBind();
         this.dropBrandList.DataBind();
         this.dropTagList.DataBind();
         this.dropType.DataBind();
     }
 }
示例#10
0
        private void LoadShipper()
        {
            StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId);

            if (storeById != null)
            {
                this.ltlAddress.Text    = storeById.Address;
                this.ltlCellPhone.Text  = storeById.Tel;
                this.ltlShipTo.Text     = storeById.ContactMan;
                this.ltlRegion.Text     = RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0);
                this.pnlShipper.Visible = true;
            }
            else
            {
                this.pnlShipper.Visible = false;
            }
        }
示例#11
0
        private void CancelSendGoods(HttpContext context)
        {
            StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.ManagerId);
            string     text      = context.Request["OrderId"].ToNullString();
            int        num       = context.Request["ReasonId"].ToInt(0);
            string     text2     = context.Request["CancelReason"].ToNullString();

            if (string.IsNullOrEmpty(text))
            {
                context.Response.Write(this.GetFailResultJson("错误的订单编号"));
            }
            else
            {
                OrderInfo orderInfo = TradeHelper.GetOrderInfo(text);
                if (orderInfo == null)
                {
                    context.Response.Write(this.GetFailResultJson("订单信息不存在"));
                }
                else if (orderInfo.StoreId != storeById.StoreId)
                {
                    context.Response.Write(this.GetFailResultJson("订单不是该门店的"));
                }
                else if (num == 0)
                {
                    context.Response.Write(this.GetFailResultJson("请选择取消原因"));
                }
                else
                {
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                    DadaHelper.orderFormalCancel(masterSettings.DadaSourceID, text, num, text2);
                    orderInfo.OrderStatus = OrderStatus.BuyerAlreadyPaid;
                    orderInfo.CloseReason = text2;
                    orderInfo.DadaStatus  = DadaStatus.Cancel;
                    TradeHelper.UpdateOrderInfo(orderInfo);
                    string s = JsonConvert.SerializeObject(new
                    {
                        Result = new
                        {
                            Status = "SUCCESS"
                        }
                    });
                    context.Response.Write(s);
                    context.Response.End();
                }
            }
        }
示例#12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack && !int.TryParse(this.Page.Request.QueryString["StoreId"], out this.StoreId))
     {
         base.GotoResourceNotFound();
     }
     else if (this.StoreId > 0)
     {
         StoresInfo storeById = StoresHelper.GetStoreById(this.StoreId);
         if (storeById != null)
         {
             this.storeName.Text = storeById.StoreName;
         }
         this.hidStoreId.Value = this.StoreId.ToString();
         this.dropCategories.DataBind();
         this.OnStore.NavigateUrl = "StoresList.aspx";
         this.OnSale.NavigateUrl  = "StoreMoveProductList.aspx?StoreId=" + this.StoreId;
     }
 }
示例#13
0
        public void BindData()
        {
            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.txtWXTelephone.Text      = storeById.Tel;
                this.hidUploadImages.Value    = 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;
            }
        }
示例#14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.IsModifyPrice.Parameter.Add("onSwitchChange", "fuCheckEnablePrice");
     this.storeId = base.Request.QueryString["StoreId"].ToInt(0);
     if (this.storeId == 0)
     {
         base.Response.Redirect("StoresList.aspx");
     }
     this.btnOK.Click += this.btnOK_Click;
     if (!this.Page.IsPostBack)
     {
         StoresInfo storeById = StoresHelper.GetStoreById(this.storeId);
         this.lblStoreName.Text = storeById.StoreName;
         this.IsShelvesProduct.SelectedValue = storeById.IsShelvesProduct;
         this.IsModifyPrice.SelectedValue    = storeById.IsModifyPrice;
         this.txtMinPriceRate.Text           = storeById.MinPriceRate.ToNullString();
         this.txtMaxPriceRate.Text           = storeById.MaxPriceRate.ToNullString();
         this.IsRequestBlance.SelectedValue  = storeById.IsRequestBlance;
     }
 }
示例#15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.ProductIds = this.Page.Request.QueryString["ProductIds"];
         this.StoreId    = this.Page.Request.QueryString["StoreId"].ToInt(0);
         if (this.StoreId < 0 || string.IsNullOrWhiteSpace(this.ProductIds))
         {
             base.GotoResourceNotFound();
         }
         else
         {
             StoresInfo storeById = StoresHelper.GetStoreById(this.StoreId);
             if (storeById != null)
             {
                 if (!storeById.IsModifyPrice)
                 {
                     this.priceTip.Visible       = false;
                     this.hidIsModifyPrice.Value = "0";
                 }
                 else
                 {
                     decimal?maxPriceRate = storeById.MaxPriceRate;
                     if (maxPriceRate.GetValueOrDefault() > default(decimal) && maxPriceRate.HasValue)
                     {
                         this.priceTip.Visible       = true;
                         this.priceTipMessage.Text   = $"可设置价格区间为商品价格的{storeById.MinPriceRate.ToNullString()}倍-{storeById.MaxPriceRate.ToNullString()}倍";
                         this.hidIsModifyPrice.Value = "1";
                         this.hidMinPriceRate.Value  = storeById.MinPriceRate.ToNullString();
                         this.hidMaxPriceRate.Value  = storeById.MaxPriceRate.ToNullString();
                     }
                 }
             }
             this.hidStoreId.Value    = this.StoreId.ToString();
             this.hidProductIds.Value = this.ProductIds;
             this.BindProduct();
         }
     }
 }
示例#16
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (this.IsModifyPrice.SelectedValue)
            {
                if (this.txtMinPriceRate.Text.ToDecimal(0) > 100m || this.txtMinPriceRate.Text.ToDecimal(0) < decimal.Zero)
                {
                    this.ShowMsg("请输入正确的最小价格倍数!", false);
                    return;
                }
                if (this.txtMaxPriceRate.Text.ToDecimal(0) > 100m || this.txtMaxPriceRate.Text.ToDecimal(0) < decimal.Zero)
                {
                    this.ShowMsg("请输入正确的最大价格倍数!", false);
                    return;
                }
                if (this.txtMaxPriceRate.Text.ToDecimal(0) < this.txtMinPriceRate.Text.ToDecimal(0))
                {
                    this.ShowMsg("最大价格倍数需大于最小价格倍数!", false);
                    return;
                }
            }
            decimal?d  = null;
            decimal?d2 = null;

            if (this.IsModifyPrice.SelectedValue)
            {
                d  = (string.IsNullOrEmpty(this.txtMinPriceRate.Text) ? null : new decimal?(this.txtMinPriceRate.Text.ToDecimal(0)));
                d2 = (string.IsNullOrEmpty(this.txtMaxPriceRate.Text) ? null : new decimal?(this.txtMaxPriceRate.Text.ToDecimal(0)));
            }
            StoresInfo storeById = StoresHelper.GetStoreById(this.storeId);

            storeById.IsShelvesProduct = this.IsShelvesProduct.SelectedValue;
            storeById.IsModifyPrice    = this.IsModifyPrice.SelectedValue;
            storeById.MinPriceRate     = Math.Floor((d * (decimal?)100).ToDecimal(0)) / 100m;
            storeById.MaxPriceRate     = Math.Floor((d2 * (decimal?)100).ToDecimal(0)) / 100m;
            storeById.IsRequestBlance  = this.IsRequestBlance.SelectedValue;
            StoresHelper.UpdateStore(storeById);
            this.ShowMsg("保存成功", true);
        }
示例#17
0
        public void ClearTradePassword(HttpContext context)
        {
            int value = base.GetIntParam(context, "StoreId", false).Value;

            if (value <= 0)
            {
                throw new HidistroAshxException("错误的参数");
            }
            StoresInfo storeById = StoresHelper.GetStoreById(value);

            if (storeById == null)
            {
                throw new HidistroAshxException("错误的门店ID");
            }
            storeById.TradePassword     = "";
            storeById.TradePasswordSalt = "";
            if (StoresHelper.UpdateStore(storeById))
            {
                base.ReturnSuccessResult(context, "清空成功!", 0, true);
                return;
            }
            throw new HidistroAshxException("清空失败!");
        }
示例#18
0
        private void Save()
        {
            StringBuilder  sbLocalImage = new StringBuilder();
            IList <string> list         = new List <string>();
            StoresInfo     storeById    = StoresHelper.GetStoreById(this.storeId);

            if (!storeById.WXState.HasValue)
            {
                this.AddWXStore();
            }
            else if (storeById.WXState.HasValue && storeById.WXState.Value.Equals(WXStoreState.Pass))
            {
                IEnumerable <string> enumerable      = this.BuildImages(sbLocalImage, list);
                UpdateStoreData      updateStoreData = new UpdateStoreData();
                foreach (string item in enumerable)
                {
                    updateStoreData.business.base_info.photo_list.Add(new Store_Photo
                    {
                        photo_url = item
                    });
                }
                updateStoreData.business.base_info.avg_price    = this.txtWXAvgPrice.Text.ToInt(0);
                updateStoreData.business.base_info.introduction = this.txtWXIntroduction.Text.Trim();
                updateStoreData.business.base_info.open_time    = this.txtWXOpenTime.Text.Trim();
                updateStoreData.business.base_info.recommend    = this.txtWXRecommend.Text.Trim();
                updateStoreData.business.base_info.poi_id       = (storeById.WXPoiId.HasValue ? storeById.WXPoiId.Value.ToString() : string.Empty);
                updateStoreData.business.base_info.special      = this.txtWXSpecial.Text.Trim();
                updateStoreData.business.base_info.telephone    = this.txtWXTelephone.Text.Trim();
                WXStoreHelper.UpdateWXStore(updateStoreData);
                storeById.StoreImages = ((list.Count == 0) ? string.Empty : string.Join(",", list.ToArray()));
                StoresHelper.UpdateWXStore(updateStoreData, storeById.StoreId, storeById.StoreImages);
            }
            else
            {
                this.ShowMsg("微信门店审核中不能修改", false);
            }
        }
        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\"}");
                }
            }
        }
示例#20
0
        protected override void AttachChildControls()
        {
            base.CheckOpenMultStore();
            this.storeLogo        = (HtmlImage)this.FindControl("storeLogo");
            this.litAddress       = (Literal)this.FindControl("litAddress");
            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.litActivityList  = (Literal)this.FindControl("litActivityList");
            this.litActivityCount = (Literal)this.FindControl("litActivityCount");
            this.hidLatitude      = (HtmlInputHidden)this.FindControl("hidLatitude");
            this.hidLongitude     = (HtmlInputHidden)this.FindControl("hidLongitude");
            this.hidStoreName     = (HtmlInputHidden)this.FindControl("hidStoreName");
            this.hidIsOpenData    = (HtmlInputHidden)this.FindControl("hidIsOpenData");
            this.hdQQMapKey       = (HtmlInputHidden)this.FindControl("hdQQMapKey");
            this.rp_markting      = (Repeater)this.FindControl("rp_markting");
            int.TryParse(this.Page.Request.QueryString["storeId"], out this.storeId);
            int    num    = this.Page.Request.QueryString["storeSource"].ToInt(0);
            string cookie = WebHelper.GetCookie("UserCoordinateCookie", "Coordinate");

            this.hidIsReloadPosition = (HtmlInputHidden)this.FindControl("hidIsReloadPosition");
            this.aTel          = (HtmlAnchor)this.FindControl("aTel");
            this.litStoreTel   = (Literal)this.FindControl("litStoreTel");
            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 = HiContext.Current.SiteSettings.WeixinAppId;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (!masterSettings.OpenMultStore)
            {
                this.Page.Response.Redirect("Default.aspx");
            }
            else if (masterSettings.Store_PositionRouteTo == 2.ToString() && num != 3 && num != 2 && num != 1 && num != 4)
            {
                this.Page.Response.Redirect("StoreList?from");
            }
            this.hdQQMapKey.Value = (string.IsNullOrEmpty(masterSettings.QQMapAPIKey) ? "SYJBZ-DSLR3-IWX3Q-3XNTM-ELURH-23FTP" : masterSettings.QQMapAPIKey);
            string cookie2 = WebHelper.GetCookie("UserCoordinateTimeCookie");

            if (this.storeId > 0 && !string.IsNullOrWhiteSpace(cookie) && !string.IsNullOrEmpty(cookie2))
            {
                StoresInfo storeById = StoresHelper.GetStoreById(this.storeId);
                if (storeById != null && storeById.StoreId > 0)
                {
                    this.hdTitle.Value = storeById.StoreName;
                    this.hdDesc.Value  = storeById.StoreName;
                    string storeImages = storeById.StoreImages;
                    string local       = string.IsNullOrEmpty(storeImages) ? SettingsManager.GetMasterSettings().LogoUrl : storeImages;
                    this.hdImgUrl.Value = Globals.FullPath(local);
                    this.hdLink.Value   = Globals.FullPath(this.Page.Request.Url.ToString());
                    MemberInfo user = HiContext.Current.User;
                    if (user.UserId != 0 && user.IsReferral() && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
                    {
                        string text = HttpContext.Current.Request.Url.ToString();
                        text = ((text.IndexOf("?") <= -1) ? (text + "?ReferralUserId=" + HiContext.Current.UserId) : (text + "&ReferralUserId=" + HiContext.Current.UserId));
                        this.Page.Response.Redirect(text);
                    }
                    else
                    {
                        string cookie3 = WebHelper.GetCookie("UserCoordinateCookie");
                        this.litAddress.Text = HttpUtility.UrlDecode(WebHelper.GetCookie("UserCoordinateCookie", "Address"));
                        this.storeLogo.Src   = storeById.StoreImages;
                        this.litStoreName.SetWhenIsNotNull("<a href=\"StoreAbout?StoreId=" + storeById.StoreId + "\">" + storeById.StoreName + "</a>");
                        this.litStoreName2.SetWhenIsNotNull("<a href=\"StoreAbout?StoreId=" + storeById.StoreId + "\">" + storeById.StoreName + "</a>");
                        string   text2    = (storeById.OpenEndDate < storeById.OpenStartDate) ? "次日" : "";
                        Literal  literal  = this.litOpenDate;
                        DateTime dateTime = storeById.OpenStartDate;
                        string   arg      = dateTime.ToString("HH:mm");
                        string   arg2     = text2;
                        dateTime     = storeById.OpenEndDate;
                        literal.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();
                        this.hidStoreName.Value = storeById.StoreName.ToString();
                        this.aTel.HRef          = "tel://" + storeById.Tel;
                        this.litStoreTel.Text   = storeById.Tel;
                        if (!base.site.Store_IsOrderInClosingTime)
                        {
                            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);
                            }
                            this.hidIsOpenData.Value = "true";
                            if (DateTime.Now < value || DateTime.Now > dateTime2)
                            {
                                this.hidIsOpenData.Value = "false";
                            }
                        }
                        if (storeById.IsStoreDelive)
                        {
                            decimal?minOrderPrice = storeById.MinOrderPrice;
                            int     num2;
                            if (minOrderPrice.GetValueOrDefault() > default(decimal) && minOrderPrice.HasValue)
                            {
                                Literal literal2 = this.litStoreDelive;
                                num2          = storeById.MinOrderPrice.ToInt(0);
                                literal2.Text = $"¥{num2.ToString()}起送,";
                            }
                            minOrderPrice = storeById.StoreFreight;
                            if (minOrderPrice.GetValueOrDefault() > default(decimal) && minOrderPrice.HasValue)
                            {
                                Literal literal3 = this.litStoreDelive;
                                string  text3    = literal3.Text;
                                num2          = storeById.StoreFreight.ToInt(0);
                                literal3.Text = text3 + $"配送费¥{num2.ToString()}";
                            }
                            else
                            {
                                Literal literal4 = this.litStoreDelive;
                                literal4.Text += "免配送费";
                            }
                        }
                        StoreActivityEntityList storeActivity = StoresHelper.GetStoreActivity(this.storeId);
                        if (storeActivity != null)
                        {
                            StringBuilder stringBuilder = new StringBuilder();
                            if (storeActivity.FullAmountReduceList.Count > 0)
                            {
                                stringBuilder.AppendFormat("<div class=\"jian\"><i class=\"tag tag_green\">减</i><span>");
                                int num3 = 0;
                                while (num3 < storeActivity.FullAmountReduceList.Count)
                                {
                                    if (num3 < 2)
                                    {
                                        stringBuilder.AppendFormat("{0};", storeActivity.FullAmountReduceList[num3].ActivityName);
                                        num3++;
                                        continue;
                                    }
                                    stringBuilder.AppendFormat("{0}{1}", storeActivity.FullAmountReduceList[num3].ActivityName, (storeActivity.FullAmountReduceList.Count > 3) ? "等" : "");
                                    break;
                                }
                                if (stringBuilder.ToString().EndsWith(";"))
                                {
                                    stringBuilder.Remove(stringBuilder.ToString().LastIndexOf(';'), 1);
                                }
                                stringBuilder.AppendFormat("</span></div>");
                            }
                            if (storeActivity.FullAmountSentFreightList.Count > 0)
                            {
                                stringBuilder.AppendFormat("<div class=\"mian\"><i class=\"tag tag_yellow\">免</i><span>");
                                int num4 = 0;
                                while (num4 < storeActivity.FullAmountSentFreightList.Count)
                                {
                                    if (num4 < 2)
                                    {
                                        stringBuilder.AppendFormat("{0};", storeActivity.FullAmountSentFreightList[num4].ActivityName);
                                        num4++;
                                        continue;
                                    }
                                    stringBuilder.AppendFormat("{0}{1}", storeActivity.FullAmountSentFreightList[num4].ActivityName, (storeActivity.FullAmountSentFreightList.Count > 3) ? "等" : "");
                                    break;
                                }
                                if (stringBuilder.ToString().EndsWith(";"))
                                {
                                    stringBuilder.Remove(stringBuilder.ToString().LastIndexOf(';'), 1);
                                }
                                stringBuilder.AppendFormat("</span></div>");
                            }
                            if (storeActivity.FullAmountSentGiftList.Count > 0)
                            {
                                stringBuilder.AppendFormat("<div class=\"song\"><i class=\"tag tag_blue\">送</i><span>");
                                int num5 = 0;
                                while (num5 < storeActivity.FullAmountSentGiftList.Count)
                                {
                                    if (num5 < 2)
                                    {
                                        stringBuilder.AppendFormat("{0};", storeActivity.FullAmountSentGiftList[num5].ActivityName);
                                        num5++;
                                        continue;
                                    }
                                    stringBuilder.AppendFormat("{0}{1}", storeActivity.FullAmountSentGiftList[num5].ActivityName, (storeActivity.FullAmountSentGiftList.Count > 3) ? "等" : "");
                                    break;
                                }
                                if (stringBuilder.ToString().EndsWith(";"))
                                {
                                    stringBuilder.Remove(stringBuilder.ToString().LastIndexOf(';'), 1);
                                }
                                stringBuilder.AppendFormat("</span></div>");
                            }
                            this.litActivityList.Text = stringBuilder.ToString();
                            if (storeActivity.ActivityCount > 1)
                            {
                                this.litActivityCount.Text = $"<div id=\"huod-b\"><a href=\"javascript:;\">{storeActivity.ActivityCount}个活动</a><i></i></div>";
                            }
                        }
                        if (this.rp_markting != null)
                        {
                            List <StoreMarktingInfo> storeMarktingInfoList = StoreMarktingHelper.GetStoreMarktingInfoList();
                            foreach (StoreMarktingInfo item in storeMarktingInfoList)
                            {
                                item.StoreId    = this.storeId;
                                item.RedirectTo = this.RedirectToFullPath(item.RedirectTo);
                            }
                            this.rp_markting.DataSource = storeMarktingInfoList;
                            this.rp_markting.DataBind();
                        }
                        PageTitle.AddSiteNameTitle(storeById.StoreName);
                    }
                }
            }
            else
            {
                this.hidIsReloadPosition.Value = "1";
            }
        }
示例#21
0
        private void SaveNewStock()
        {
            List <StoreSKUInfo>      list  = new List <StoreSKUInfo>();
            List <StoreStockLogInfo> list2 = new List <StoreStockLogInfo>();
            List <int> list3     = new List <int>();
            int        storeId   = HiContext.Current.Manager.StoreId;
            StoresInfo storeById = StoresHelper.GetStoreById(storeId);

            if (this.grdSelectedProducts.Items.Count > 0)
            {
                foreach (RepeaterItem item in this.grdSelectedProducts.Items)
                {
                    int         num         = 0;
                    int         num2        = 0;
                    decimal     num3        = default(decimal);
                    TextBox     textBox     = item.FindControl("txtStock") as TextBox;
                    TextBox     textBox2    = item.FindControl("txtWarningStock") as TextBox;
                    HiddenField hiddenField = item.FindControl("hidSKUContent") as HiddenField;
                    int.TryParse(textBox.Text, out num);
                    if (storeById.IsModifyPrice)
                    {
                        TextBox textBox3 = item.FindControl("txtStoreSalePrice") as TextBox;
                        decimal.TryParse(textBox3.Text, out num3);
                        if (num3 <= decimal.Zero)
                        {
                            this.ShowMsg("价格必须大于0!", false);
                            return;
                        }
                    }
                    if (num <= 0)
                    {
                        this.ShowMsg("库存必须设置大于0的数字!", false);
                        return;
                    }
                    if (num2 < 0)
                    {
                        this.ShowMsg("警戒库存必须不能为负数!", false);
                        return;
                    }
                    HiddenField  hiddenField2 = item.FindControl("HidSkuId") as HiddenField;
                    HiddenField  hiddenField3 = item.FindControl("HidProductId") as HiddenField;
                    string       value        = hiddenField2.Value;
                    int          num4         = hiddenField3.Value.ToInt(0);
                    StoreSKUInfo storeSKUInfo = new StoreSKUInfo();
                    storeSKUInfo.ProductID    = num4;
                    storeSKUInfo.SkuId        = value;
                    storeSKUInfo.Stock        = num;
                    storeSKUInfo.StoreId      = storeId;
                    storeSKUInfo.WarningStock = textBox2.Text.ToInt(0);
                    storeSKUInfo.FreezeStock  = 0;
                    if (storeById.IsModifyPrice)
                    {
                        storeSKUInfo.StoreSalePrice = num3;
                        HiddenField hiddenField4 = item.FindControl("hidSalePrice") as HiddenField;
                        decimal     num5         = hiddenField4.Value.ToDecimal(0);
                        decimal?    minPriceRate = storeById.MinPriceRate;
                        if (minPriceRate.GetValueOrDefault() > default(decimal) && minPriceRate.HasValue)
                        {
                            decimal d             = num3;
                            decimal value2        = num5;
                            decimal?minPriceRate2 = storeById.MinPriceRate;
                            minPriceRate = (decimal?)value2 * minPriceRate2;
                            if (d < minPriceRate.GetValueOrDefault() && minPriceRate.HasValue)
                            {
                                this.ShowMsg(hiddenField.Value + "门店价格不能小于平台价格的" + storeById.MinPriceRate.Value.F2ToString("f2") + "倍!", false);
                                return;
                            }
                        }
                        minPriceRate = storeById.MaxPriceRate;
                        if (minPriceRate.GetValueOrDefault() > default(decimal) && minPriceRate.HasValue)
                        {
                            decimal d2            = num3;
                            decimal value2        = num5;
                            decimal?minPriceRate2 = storeById.MaxPriceRate;
                            minPriceRate = (decimal?)value2 * minPriceRate2;
                            if (d2 > minPriceRate.GetValueOrDefault() && minPriceRate.HasValue)
                            {
                                this.ShowMsg(hiddenField.Value + "门店价格不能大于平台价格的" + storeById.MaxPriceRate.Value.F2ToString("f2") + "倍!", false);
                                return;
                            }
                        }
                    }
                    else
                    {
                        storeSKUInfo.StoreSalePrice = decimal.Zero;
                    }
                    list.Add(storeSKUInfo);
                    StoreStockLogInfo storeStockLogInfo = new StoreStockLogInfo();
                    storeStockLogInfo.ProductId  = num4;
                    storeStockLogInfo.Remark     = "从平台商品移入";
                    storeStockLogInfo.SkuId      = value;
                    storeStockLogInfo.Operator   = HiContext.Current.Manager.UserName;
                    storeStockLogInfo.StoreId    = storeId;
                    storeStockLogInfo.ChangeTime = DateTime.Now;
                    storeStockLogInfo.Content    = hiddenField.Value + "库存由【0】变成【" + num + "】";
                    StoreStockLogInfo storeStockLogInfo2 = storeStockLogInfo;
                    storeStockLogInfo2.Content = storeStockLogInfo2.Content + "警戒库存由【0】变成【" + storeSKUInfo.WarningStock + "】";
                    if (storeById.IsModifyPrice)
                    {
                        storeStockLogInfo2         = storeStockLogInfo;
                        storeStockLogInfo2.Content = storeStockLogInfo2.Content + "门店售价由【0】变成【" + num3 + "】";
                    }
                    list2.Add(storeStockLogInfo);
                    if (!list3.Contains(num4))
                    {
                        list3.Add(num4);
                    }
                }
                if (list.Count > 0)
                {
                    if (StoresHelper.AddStoreProduct(list, list2, list3))
                    {
                        base.CloseWindow(null);
                    }
                    else
                    {
                        this.ShowMsg("保存失败!", false);
                    }
                }
                this.BindProduct();
            }
        }
示例#22
0
        public void BindData()
        {
            StoresInfo  storeById   = StoresHelper.GetStoreById(this.storeId);
            ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.storeId, SystemRoles.StoreAdmin);

            if (storeById == null)
            {
                base.Response.Redirect("StoresList.aspx");
            }
            else
            {
                DbQueryResult storeDeliveryScop = StoresHelper.GetStoreDeliveryScop(new DeliveryScopeQuery
                {
                    StoreId   = storeById.StoreId,
                    PageIndex = 1,
                    PageSize  = 2147483647
                });
                this.repStoreDeliveryScop.DataSource = storeDeliveryScop.Data;
                this.repStoreDeliveryScop.DataBind();
                this.lblState.Text        = (storeById.State.Equals(0) ? "关闭" : "开启");
                this.lblUserName.Text     = managerInfo.UserName;
                this.lblStoreName.Text    = storeById.StoreName;
                this.lblRegions.Text      = RegionHelper.GetFullRegion(storeById.RegionId, string.Empty, true, 0);
                this.lblAddress.Text      = storeById.Address;
                this.lblContactMan.Text   = storeById.ContactMan;
                this.lblTel.Text          = storeById.Tel;
                this.lblCategoryName.Text = storeById.WXCategoryName;
                Literal literal  = this.lblServeRadius;
                double? nullable = storeById.ServeRadius;
                literal.Text = nullable.ToString();
                this.lblStoreOpenTime.Text  = (string.IsNullOrEmpty(storeById.StoreOpenTime) ? "无" : storeById.StoreOpenTime);
                this.lblIsAboveSelf.Text    = (storeById.IsAboveSelf ? "是" : "否");
                this.lblWXBusinessName.Text = storeById.WXBusinessName;
                this.lblWXBranchName.Text   = storeById.WXBranchName;
                this.lblWxAddress.Text      = storeById.WxAddress;
                HiddenField hiddenField = this.hfLongitude;
                nullable          = storeById.Longitude;
                hiddenField.Value = nullable.ToString();
                HiddenField hiddenField2 = this.hfLatitude;
                nullable                 = storeById.Latitude;
                hiddenField2.Value       = nullable.ToString();
                this.lblWXTelephone.Text = storeById.WXTelephone;
                Literal literal2  = this.lblWXAvgPrice;
                int?    nullable2 = storeById.WXAvgPrice;
                literal2.Text               = nullable2.ToString();
                this.lblWXOpenTime.Text     = storeById.WXOpenTime;
                this.lblWXRecommend.Text    = storeById.WXRecommend;
                this.lblWXSpecial.Text      = storeById.WXSpecial;
                this.lblWXIntroduction.Text = storeById.WXIntroduction;
                HiddenField hiddenField3 = this.hidIsWX;
                nullable2          = storeById.WXState;
                hiddenField3.Value = nullable2.ToString();
                if (!string.IsNullOrEmpty(storeById.StoreImages))
                {
                    string[] array = storeById.StoreImages.Split(',');
                    foreach (string text in array)
                    {
                        if (!string.IsNullOrEmpty(text.Trim()))
                        {
                            Literal literal3 = this.lblImages;
                            literal3.Text += $"<img src='{text}' width='98' height='98' style='padding:0 10px;'/>";
                        }
                    }
                }
            }
        }
示例#23
0
 private void btnAdminLogin_Click(object sender, EventArgs e)
 {
     if (this.imgCode.Visible && !HiContext.Current.CheckVerifyCode(this.txtCode.Text.Trim(), ""))
     {
         this.ShowMessage("验证码不正确");
     }
     else
     {
         ManagerInfo managerInfo = ManagerHelper.ValidLogin(this.txtAdminName.Text, this.txtAdminPassWord.Text);
         if (managerInfo != null)
         {
             if (managerInfo.RoleId == -2)
             {
                 SiteSettings siteSettings = HiContext.Current.SiteSettings;
                 if (!siteSettings.OpenSupplier)
                 {
                     this.ShowMessage("未开启供应商模块!");
                     return;
                 }
             }
             Task task = Task.Factory.StartNew(delegate
             {
                 this.DeleteTempFolder();
             });
             HttpCookie httpCookie = new HttpCookie("popTime");
             httpCookie.Value = this.LastActivyTime;
             HttpCookie httpCookie2 = new HttpCookie("popTimes");
             httpCookie2.Value = "0";
             HttpCookie httpCookie3 = new HttpCookie("popData");
             httpCookie3.Value = "";
             HttpContext.Current.Response.Cookies.Add(httpCookie);
             HttpContext.Current.Response.Cookies.Add(httpCookie2);
             HttpContext.Current.Response.Cookies.Add(httpCookie3);
             this.UpdateSiteSettings();
             string      userData = string.Empty;
             SystemRoles systemRoles;
             if (managerInfo.RoleId == 0)
             {
                 systemRoles = SystemRoles.SystemAdministrator;
                 userData    = systemRoles.ToString();
             }
             else if (managerInfo.RoleId == -1)
             {
                 systemRoles = SystemRoles.StoreAdmin;
                 userData    = systemRoles.ToString();
             }
             else if (managerInfo.RoleId == -2)
             {
                 systemRoles = SystemRoles.SupplierAdmin;
                 userData    = systemRoles.ToString();
             }
             else if (managerInfo.RoleId == -3)
             {
                 systemRoles = SystemRoles.ShoppingGuider;
                 userData    = systemRoles.ToString();
             }
             FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, managerInfo.ManagerId.ToString(), DateTime.Now, DateTime.Now.AddMinutes(30.0), false, userData, "/");
             string     value       = FormsAuthentication.Encrypt(ticket);
             HttpCookie httpCookie4 = new HttpCookie(FormsAuthentication.FormsCookieName, value);
             httpCookie4.HttpOnly = true;
             HiContext.Current.Context.Response.Cookies.Add(httpCookie4);
             this.RemoveCache();
             string text = string.Empty;
             if (!string.IsNullOrEmpty(this.Page.Request.QueryString["returnUrl"]))
             {
                 text = this.Page.Request.QueryString["returnUrl"];
             }
             if (text == null && this.ReferralLink != null && !string.IsNullOrEmpty(this.ReferralLink.Trim()))
             {
                 text = this.ReferralLink;
             }
             Globals.AppendLog(new Dictionary <string, string>(), "Login:"******"," + managerInfo.RoleId, "", "", "/log/Login.txt");
             if (managerInfo.RoleId == -1 || managerInfo.RoleId == -3)
             {
                 if (managerInfo.Status == 0 && managerInfo.RoleId == -3)
                 {
                     this.ShowMessage("子帐号已被冻结,无法登录!");
                     return;
                 }
                 StoresInfo storeById = StoresHelper.GetStoreById(managerInfo.StoreId);
                 if (storeById == null || storeById.State == 0)
                 {
                     this.ShowMessage("门店已被关闭,无法登录!");
                     return;
                 }
                 if (!string.IsNullOrEmpty(text) && text.ToLower().IndexOf("/depot/") >= 0)
                 {
                     this.Page.Response.Redirect(text, true);
                 }
                 else
                 {
                     base.Response.Write("<script language='javascript'>window.parent.location.href='/depot/default.html?v=" + HiContext.Current.Config.Version + "';</script>");
                     base.Response.End();
                 }
             }
             else if (managerInfo.RoleId == -2)
             {
                 base.Response.Write("<script language='javascript'>window.parent.location.href='/Supplier/default.html?v=" + HiContext.Current.Config.Version + "';</script>");
                 base.Response.End();
             }
             else
             {
                 base.Response.Write("<script language='javascript'>window.parent.location.href='/Admin/default.html?v=" + HiContext.Current.Config.Version + "';</script>");
                 base.Response.End();
             }
             if (!string.IsNullOrEmpty(text) && (text.ToLower().IndexOf("logout") >= 0 || text.ToLower().IndexOf("register") >= 0 || text.ToLower().IndexOf("votelist") >= 0 || text.ToLower().IndexOf("loginexit") >= 0))
             {
                 text = null;
             }
             if (text != null)
             {
                 this.Page.Response.Redirect(text, true);
             }
             else
             {
                 this.Page.Response.Redirect("default.html?v=" + HiContext.Current.Config.Version, true);
             }
         }
         else
         {
             this.SetErrorTimes("username");
             this.ShowMessage("用户名或密码错误!");
         }
     }
 }
示例#24
0
        private void UpdateStores()
        {
            StoresInfo  storeById   = StoresHelper.GetStoreById(this.storeId);
            ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.storeId, SystemRoles.StoreAdmin);

            if (storeById == null)
            {
                base.Response.Redirect("StoresList.aspx");
            }
            double  num     = 0.0;
            int     num2    = 0;
            int     num3    = 0;
            decimal num4    = default(decimal);
            string  text    = "";
            string  text2   = "";
            string  Address = "";
            string  text3   = Globals.StripAllTags(this.txtStoresName.Text.Trim());

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

            text  = this.txtTel.Text;
            text2 = this.txtContactMan.Text;
            string[] array  = text4.Split(',');
            string[] array2 = text5.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);
                }
            }
            if (storeById.StoreName != text3 && StoresHelper.ExistStoreName(text3))
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("门店名称已经存在,请重新输入!", false);
            }
            else if (string.Compare(this.txtUserPwd.Text, this.txtUserRePwd.Text) != 0)
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请确保两次输入的密码相同", false);
            }
            else if (!this.dropRegion.GetSelectedRegionId().HasValue)
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请选择店铺所在区域!", false);
            }
            else if (text2.Length > 8 || text2.Length < 2)
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请输入联系人,联系人长度必须是2-8位!", false);
            }
            else if (string.IsNullOrEmpty(this.hfLatitude.Value) || string.IsNullOrEmpty(this.hfLongitude.Value))
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请给门店标注定位!", false);
            }
            else if (text == "" || !DataHelper.IsTel(text))
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请输入正确的联系电话(手机或者固定电话)!", false);
            }
            else
            {
                if (!string.IsNullOrEmpty(this.txtUserPwd.Text))
                {
                    if (this.txtUserPwd.Text.Length < 6 || this.txtUserPwd.Text.Length > 20)
                    {
                        this.ResetForm(storeById.StoreId);
                        this.ShowMsg("密码长度必须在6到20个字符之间!", false);
                        return;
                    }
                    managerInfo.Password = Users.EncodePassword(this.txtUserPwd.Text, managerInfo.PasswordSalt);
                }
                if (!this.chkIsSupportExpress.Checked && !this.chkIsAboveSelf.Checked && !this.chkIsStoreDelive.Checked)
                {
                    this.ResetForm(storeById.StoreId);
                    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(storeById.StoreId);
                            this.ShowMsg("请输入正确的配送半径,为大于0至10000之间的数字!", false);
                            return;
                        }
                        if (!int.TryParse(this.txtStoreFreight.Text.Trim(), out num2) || num2 > 99999999 || num2 < 0)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的配送费", false);
                            return;
                        }
                        if (!int.TryParse(this.txtMinOrderPrice.Text.Trim(), out num3) || num3 > 99999999 || num3 < 0)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的起送价", false);
                            return;
                        }
                    }
                    if (!decimal.TryParse(this.txtCommissionRate.Text.Trim(), out num4) || num4 > 100m || num4 < decimal.Zero)
                    {
                        this.ResetForm(storeById.StoreId);
                        this.ShowMsg("请输入正确的平台抽佣比例", false);
                    }
                    else if (!this.chkOfflinePay.Checked && !this.chkOnlinePay.Checked && !this.chkCashOnDelivery.Checked)
                    {
                        this.ResetForm(storeById.StoreId);
                        this.ShowMsg("支付方式请至少选择一种", false);
                    }
                    else
                    {
                        storeById.IsOfflinePay     = this.chkOfflinePay.Checked;
                        storeById.IsOnlinePay      = this.chkOnlinePay.Checked;
                        storeById.IsCashOnDelivery = this.chkCashOnDelivery.Checked;
                        if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartH.Text) || this.txtStoreOpenTimeStartH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartH.Text.ToInt(0) >= 24)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的营业起始小时", false);
                        }
                        else if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartM.Text) || this.txtStoreOpenTimeStartM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartM.Text.ToInt(0) >= 60)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的营业起始分钟", false);
                        }
                        else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndH.Text) || this.txtStoreOpenTimeEndH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndH.Text.ToInt(0) >= 24)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的营业结束小时", false);
                        }
                        else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndM.Text) || this.txtStoreOpenTimeEndM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndM.Text.ToInt(0) >= 60)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的营业结束分钟", false);
                        }
                        else
                        {
                            string   empty     = string.Empty;
                            DateTime dateTime  = DateTime.Now;
                            string   text6     = dateTime.ToString("yyyy-MM-dd");
                            DateTime?nullable  = (text6 + " " + this.txtStoreOpenTimeStartH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeStartM.Text.ToInt(0)).ToDateTime();
                            DateTime?nullable2 = (text6 + " " + this.txtStoreOpenTimeEndH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeEndM.Text.ToInt(0)).ToDateTime();
                            dateTime = nullable.Value;
                            string str = dateTime.ToString("HH:mm");
                            dateTime = nullable2.Value;
                            string text7 = dateTime.ToString("HH:mm");
                            if (text7 == "00:00")
                            {
                                nullable2 = (text6 + " 23:59").ToDateTime();
                                text7     = "23:59";
                            }
                            empty = (storeById.StoreOpenTime = str + "-" + text7);
                            storeById.OpenStartDate    = nullable.Value;
                            storeById.OpenEndDate      = nullable2.Value;
                            storeById.IsSupportExpress = (this.chkIsSupportExpress.Checked && true);
                            storeById.IsAboveSelf      = (this.chkIsAboveSelf.Checked && true);
                            storeById.IsStoreDelive    = (this.chkIsStoreDelive.Checked && true);
                            storeById.Introduce        = this.editDescription.Text;
                            if (this.chkIsStoreDelive.Checked)
                            {
                                storeById.ServeRadius   = num;
                                storeById.MinOrderPrice = num3;
                                storeById.StoreFreight  = num2;
                            }
                            else
                            {
                                storeById.ServeRadius   = 0.0;
                                storeById.MinOrderPrice = null;
                                storeById.StoreFreight  = null;
                            }
                            storeById.CommissionRate = num4;
                            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);
                            });
                            IList <string> list2  = new List <string>();
                            string         text9  = this.hidUploadImages.Value.Trim();
                            string[]       array3 = text9.Split(',');
                            for (int j = 0; j < array3.Length; j++)
                            {
                                if (!string.IsNullOrEmpty(array3[j]))
                                {
                                    string text10      = Globals.SaveFile("depot", array3[j], "/Storage/master/", true, false, "");
                                    string text11      = base.Request.MapPath(text10);
                                    string virtualPath = HiContext.Current.GetStoragePath() + "/depot/thum_" + text10.Substring(text10.LastIndexOf("/") + 1);
                                    if (!File.Exists(text11))
                                    {
                                        this.ShowMsg("缩略图文件夹未创建,请联系管理员", false);
                                        return;
                                    }
                                    ResourcesHelper.CreateThumbnail(text11, base.Request.MapPath(virtualPath), 160, 160);
                                    list2.Add(text10);
                                }
                            }
                            if (list2.Count == 0)
                            {
                                this.ResetForm(storeById.StoreId);
                                this.ShowMsg("logo已失效或未上传,请上传门店logo", false);
                            }
                            else if (ManagerHelper.Update(managerInfo))
                            {
                                int value = this.dropRegion.GetSelectedRegionId().Value;
                                storeById.StoreName      = text3;
                                storeById.RegionId       = value;
                                storeById.TopRegionId    = RegionHelper.GetCityId(value);
                                storeById.Tel            = text;
                                storeById.Address        = Address;
                                storeById.ContactMan     = text2;
                                storeById.StoreImages    = ((list2.Count == 0) ? string.Empty : string.Join(",", list2.ToArray()));
                                storeById.Longitude      = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLongitude.Value) ? "0" : this.hfLongitude.Value), 6);
                                storeById.Latitude       = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLatitude.Value) ? "0" : this.hfLatitude.Value), 6);
                                storeById.FullRegionPath = RegionHelper.GetFullPath(value, true);
                                StoresHelper.UpdateStore(storeById);
                                HiCache.Remove("DataCache-StoreInfoDataKey");
                                if (dictionary.Count > 0 && this.chkIsStoreDelive.Checked)
                                {
                                    StoresHelper.AddDeliveryScope(this.storeId, dictionary);
                                }
                                else
                                {
                                    StoresHelper.DeleteDevlieryScope(this.storeId);
                                }
                                if (!string.IsNullOrEmpty(this.txtStoreTag.Text.Trim()))
                                {
                                    IList <int> list3  = new List <int>();
                                    string      text12 = this.txtStoreTag.Text.Trim();
                                    string[]    array4 = null;
                                    array4 = ((!text12.Contains(",")) ? new string[1]
                                    {
                                        text12
                                    } : text12.Split(','));
                                    string[] array5 = array4;
                                    foreach (string value2 in array5)
                                    {
                                        list3.Add(Convert.ToInt32(value2));
                                    }
                                    StoresHelper.DeleteStoreTags(this.storeId);
                                    StoresHelper.BindStoreTags(this.storeId, list3);
                                }
                                else
                                {
                                    StoresHelper.DeleteStoreTags(this.storeId);
                                }
                                HiCache.Remove($"DataCache-StoreStateCacheKey-{storeById.StoreId}");
                                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                if (masterSettings.OpenDadaLogistics)
                                {
                                    DataTable dataTable = DepotHelper.SynchroDadaStoreList(this.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 text13          = dataTable.Rows[l]["StoreId"].ToNullString();
                                            string text14          = DadaHelper.shopUpdate(masterSettings.DadaSourceID, this.storeId.ToString(), "", station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, -1);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#25
0
        public void BindData()
        {
            StoresInfo  storeById   = StoresHelper.GetStoreById(this.storeId);
            ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.storeId, SystemRoles.StoreAdmin);

            if (storeById == null)
            {
                base.Response.Redirect("StoresList.aspx");
            }
            else
            {
                string empty  = string.Empty;
                string empty2 = string.Empty;
                if (!string.IsNullOrEmpty(storeById.WXCategoryName))
                {
                    empty  = storeById.WXCategoryName.Split(',')[0];
                    empty2 = storeById.WXCategoryName.Split(',')[1];
                }
                this.editDescription.Text = storeById.Introduce;
                HiddenField hiddenField = this.hidOldRegion;
                int         num         = storeById.RegionId;
                hiddenField.Value = num.ToString();
                IEnumerable <string> values = RegionHelper.GetFullRegion(storeById.RegionId, ",", true, 0).Split(',').Take(3);
                this.hfProvinceCityArea.Value = string.Join(",", values);
                HiddenField hiddenField2 = this.hidOldAddress;
                TrimTextBox trimTextBox  = this.txtAddress;
                string      text3        = hiddenField2.Value = (trimTextBox.Text = string.Join(string.Empty, values) + storeById.Address);
                this.txtContactMan.Text = storeById.ContactMan;
                IList <DeliveryScopeInfo> storeDeliveryScop = StoresHelper.GetStoreDeliveryScop(storeById.StoreId);
                string text4 = "";
                string text5 = "";
                this.chkOfflinePay.Checked     = storeById.IsOfflinePay;
                this.chkOnlinePay.Checked      = storeById.IsOnlinePay;
                this.chkCashOnDelivery.Checked = storeById.IsCashOnDelivery;
                foreach (DeliveryScopeInfo item in storeDeliveryScop)
                {
                    text4 = text4 + item.RegionId + ",";
                    text5 = text5 + item.RegionName + ",";
                }
                text4 = text4.TrimEnd(',');
                text5 = text5.TrimEnd(',');
                this.txtRegionScop.Value     = text4;
                this.txtRegionScopName.Value = text5;
                this.txtStoresName.Text      = storeById.StoreName;
                this.txtTel.Text             = storeById.Tel;
                this.labStoreUserName.Text   = managerInfo.UserName;
                this.dropRegion.SetSelectedRegionId(storeById.RegionId);
                this.hidOldImages.Value = storeById.StoreImages;
                HiddenField hiddenField3 = this.hidOldLatitude;
                HiddenField hiddenField4 = this.hfLatitude;
                double?     nullable     = storeById.Latitude;
                object      text6;
                double      value;
                if (!nullable.HasValue)
                {
                    text6 = string.Empty;
                }
                else
                {
                    nullable = storeById.Latitude;
                    value    = nullable.Value;
                    text6    = value.ToString();
                }
                text3 = (string)text6;
                hiddenField4.Value = (string)text6;
                hiddenField3.Value = text3;
                HiddenField hiddenField5 = this.hidOldLongitude;
                HiddenField hiddenField6 = this.hfLongitude;
                nullable = storeById.Longitude;
                object text7;
                if (!nullable.HasValue)
                {
                    text7 = string.Empty;
                }
                else
                {
                    nullable = storeById.Longitude;
                    value    = nullable.Value;
                    text7    = value.ToString();
                }
                text3 = (string)text7;
                hiddenField6.Value = (string)text7;
                hiddenField5.Value = text3;
                if (!string.IsNullOrEmpty(storeById.StoreOpenTime))
                {
                    string[] array  = storeById.StoreOpenTime.Split('-');
                    string[] array2 = array[0].Split(':');
                    this.txtStoreOpenTimeStartH.Text = array2[0];
                    this.txtStoreOpenTimeStartM.Text = ((array2.Length > 1) ? array2[1] : "");
                    if (array.Length > 1)
                    {
                        string[] array3 = array[1].Split(':');
                        this.txtStoreOpenTimeEndH.Text = array3[0];
                        this.txtStoreOpenTimeEndM.Text = ((array3.Length > 1) ? array3[1] : "");
                    }
                }
                this.chkIsAboveSelf.Checked      = storeById.IsAboveSelf;
                this.chkIsSupportExpress.Checked = storeById.IsSupportExpress;
                this.chkIsStoreDelive.Checked    = storeById.IsStoreDelive;
                TrimTextBox trimTextBox2 = this.txtServeRadius;
                nullable          = storeById.ServeRadius;
                trimTextBox2.Text = nullable.ToString();
                TrimTextBox trimTextBox3 = this.txtMinOrderPrice;
                object      text8;
                if (storeById.MinOrderPrice.HasValue)
                {
                    num   = storeById.MinOrderPrice.ToInt(0);
                    text8 = num.ToString();
                }
                else
                {
                    text8 = "";
                }
                trimTextBox3.Text = (string)text8;
                TrimTextBox trimTextBox4 = this.txtStoreFreight;
                object      text9;
                if (storeById.StoreFreight.HasValue)
                {
                    num   = storeById.StoreFreight.ToInt(0);
                    text9 = num.ToString();
                }
                else
                {
                    text9 = "";
                }
                trimTextBox4.Text           = (string)text9;
                this.txtCommissionRate.Text = storeById.CommissionRate.ToString();
                IList <int> storeTags = StoresHelper.GetStoreTags(this.storeId);
                this.litralStoreTag.SelectedValue = storeTags;
                if (storeTags != null && storeTags.Count > 0)
                {
                    foreach (int item2 in storeTags)
                    {
                        TrimTextBox trimTextBox5 = this.txtStoreTag;
                        trimTextBox5.Text = trimTextBox5.Text + item2.ToString() + ",";
                    }
                    this.txtStoreTag.Text = this.txtStoreTag.Text.Substring(0, this.txtStoreTag.Text.Length - 1);
                }
            }
        }
示例#26
0
        protected override void AttachChildControls()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
            {
                this.ShowWapMessage("错误的商品ID", "Default.aspx");
            }
            if (base.ClientType.Equals(ClientType.VShop))
            {
                FightGroupActivitiyModel fightGroupActivitiyModel = VShopHelper.GetFightGroupActivities(new FightGroupActivitiyQuery
                {
                    PageIndex = 1,
                    PageSize  = 1,
                    ProductId = this.productId,
                    Status    = EnumFightGroupActivitiyStatus.BeingCarried
                }).Models.FirstOrDefault();
                if (fightGroupActivitiyModel != null)
                {
                    this.Page.Response.Redirect("FightGroupActivityDetails.aspx?fightGroupActivityId=" + fightGroupActivitiyModel.FightGroupActivityId);
                }
            }
            this.hidStoreId            = (HtmlInputHidden)this.FindControl("hidStoreId");
            this.hidSupplier           = (HtmlInputHidden)this.FindControl("hidSupplier");
            this.litSupplierName       = (Literal)this.FindControl("litSupplierName");
            this.aCountDownUrl         = (HyperLink)this.FindControl("aCountDownUrl");
            this.aCountDownUrl.Visible = false;
            this.divCountDownUrl       = (HtmlGenericControl)this.FindControl("divCountDownUrl");
            this.hidCanTakeOnStore     = (HtmlInputHidden)this.FindControl("hidCanTakeOnStore");
            this.HasActivitiesToJumpUrl();
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.rptCouponList           = (WapTemplatedRepeater)this.FindControl("rptCouponList");
            this.rp_guest                = (WapTemplatedRepeater)this.FindControl("rp_guest");
            this.rp_com                  = (WapTemplatedRepeater)this.FindControl("rp_com");
            this.litProdcutName          = (Literal)this.FindControl("litProdcutName");
            this.litSalePrice            = (Literal)this.FindControl("litSalePrice");
            this.litMarketPrice          = (Literal)this.FindControl("litMarketPrice");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.ltlcombinamaininfo      = (Literal)this.FindControl("ltlcombinamaininfo");
            this.skuSubmitOrder          = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.skuStoreSubmitOrder     = (Common_SKUSubmitStoreOrder)this.FindControl("skuStoreSubmitOrder");
            this.expandAttr              = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount            = (Literal)this.FindControl("litSoldCount");
            this.litConsultationsCount   = (Literal)this.FindControl("litConsultationsCount");
            this.litReviewsCount         = (Literal)this.FindControl("litReviewsCount");
            this.litHasCollected         = (HtmlInputHidden)this.FindControl("litHasCollected");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.ltlOrderPromotion2      = (Literal)this.FindControl("ltlOrderPromotion2");
            this.ltlProductSendGifts2    = (Literal)this.FindControl("ltlProductSendGifts2");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.liOrderPromotions       = (HtmlGenericControl)this.FindControl("liOrderPromotions");
            this.liOrderPromotions2      = (HtmlGenericControl)this.FindControl("liOrderPromotions2");
            this.liProductSendGifts2     = (HtmlGenericControl)this.FindControl("liProductSendGifts2");
            this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2");
            this.liOrderPromotions_free  = (HtmlGenericControl)this.FindControl("liOrderPromotions_free");
            this.divActivities           = (HtmlGenericControl)this.FindControl("divActivities");
            this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.liProductSendGifts      = (HtmlGenericControl)this.FindControl("liProductSendGifts");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.divshiptoregion         = (HtmlGenericControl)this.FindControl("divshiptoregion");
            this.divwaplocateaddress     = (HtmlGenericControl)this.FindControl("divwaplocateaddress");
            this.promote                 = (ProductPromote)this.FindControl("ProductPromote");
            this.hdAppId                 = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTitle                 = (HtmlInputHidden)this.FindControl("hdTitle");
            this.hdDesc                  = (HtmlInputHidden)this.FindControl("hdDesc");
            this.hdImgUrl                = (HtmlInputHidden)this.FindControl("hdImgUrl");
            this.hdLink                  = (HtmlInputHidden)this.FindControl("hdLink");
            this.hidCombinaid            = (HtmlInputHidden)this.FindControl("hidCombinaid");
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.ulConsultations         = (HtmlGenericControl)this.FindControl("ulConsultations");
            this.divShortDescription     = (HtmlGenericControl)this.FindControl("divShortDescription");
            this.hidRegionId             = (HtmlInputHidden)this.FindControl("hidRegionId");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidCouponCount          = (HtmlInputHidden)this.FindControl("hidCouponCount");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divPodrequest           = (HtmlGenericControl)this.FindControl("divPodrequest");
            this.divGuest                = (HtmlGenericControl)this.FindControl("divGuest");
            this.divcombina              = (HtmlGenericControl)this.FindControl("divcombina");
            this.hidUnOnSale             = (HtmlInputHidden)this.FindControl("hidUnOnSale");
            this.hidUnAudit              = (HtmlInputHidden)this.FindControl("hidUnAudit");
            this.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.spdiscount              = (HtmlGenericControl)this.FindControl("spdiscount");
            this.ulsupplier              = (HtmlGenericControl)this.FindControl("ulsupplier");
            this.divGouMai               = (HtmlGenericControl)this.FindControl("divGouMai");
            this.ltlBottomStatus         = (Literal)this.FindControl("ltlBottomStatus");
            this.hdAppId.Value           = masterSettings.WeixinAppId;
            this.hidStoreId.Value        = this.storeId.ToString();
            HtmlInputHidden htmlInputHidden = this.hidRegionId;
            int             num             = HiContext.Current.DeliveryScopRegionId;

            htmlInputHidden.Value = num.ToString();
            this.hidden_skuItem   = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidCartQuantity  = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.lblStock         = (StockLabel)this.FindControl("lblStock");
            this.litUnit          = (Literal)this.FindControl("litUnit");
            this.lit_IsRefund     = (Literal)this.FindControl("lit_IsRefund");
            this.lit_IsOverRefund = (Literal)this.FindControl("lit_IsOverRefund");
            this.lit_RefundTime   = (Literal)this.FindControl("lit_RefundTime");
            ProductBrowseInfo wAPProductBrowseInfo = ProductBrowser.GetWAPProductBrowseInfo(this.productId, null, masterSettings.OpenMultStore, 0);
            StoreProductQuery storeProductQuery    = new StoreProductQuery
            {
                ProductId = this.productId,
                StoreId   = this.storeId
            };
            string cookie = WebHelper.GetCookie("UserCoordinateCookie", "NewCoordinate");

            if (!string.IsNullOrEmpty(cookie))
            {
                string[] array = cookie.Split(',');
                storeProductQuery.Position        = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0));
                storeProductQuery.Position.CityId = WebHelper.GetCookie("UserCoordinateCookie", "CityRegionId").ToInt(0);
                storeProductQuery.Position.AreaId = WebHelper.GetCookie("UserCoordinateCookie", "RegionId").ToInt(0);
            }
            else
            {
                storeProductQuery.Position        = new PositionInfo(0.0, 0.0);
                storeProductQuery.Position.CityId = 0;
                storeProductQuery.Position.AreaId = 0;
            }
            this.hidStoreId.Value = this.storeId.ToString();
            if (this.storeId > 0)
            {
                ProductModel storeProduct = ProductBrowser.GetStoreProduct(storeProductQuery);
                if (storeProduct == null || storeProduct.SaleStatus == ProductSaleStatus.Delete)
                {
                    this.Page.Response.Redirect("ProductDelete.aspx");
                    return;
                }
                if (storeProduct.SaleStatus == ProductSaleStatus.OnStock)
                {
                    base.GotoResourceNotFound("商品已经入库");
                }
                if (wAPProductBrowseInfo.Product.ProductType != 1.GetHashCode())
                {
                    HttpContext.Current.Response.Redirect("ProductDetail?productId=" + this.productId);
                }
                if (storeProduct.SaleStatus == ProductSaleStatus.UnSale)
                {
                    this.hidUnOnSale.Value = "1";
                }
                this.litSalePrice.Text = ((storeProduct.MinSalePrice == storeProduct.MaxSalePrice) ? storeProduct.MinSalePrice.F2ToString("f2") : (storeProduct.MinSalePrice.F2ToString("f2") + "~" + storeProduct.MaxSalePrice.F2ToString("f2")));
                this.skuStoreSubmitOrder.IsServiceProduct = true;
                this.skuStoreSubmitOrder.ProductInfo      = storeProduct;
                this.skuSubmitOrder.Visible = false;
            }
            else
            {
                if (wAPProductBrowseInfo.Product == null || wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
                {
                    this.Page.Response.Redirect("ProductDelete.aspx");
                    return;
                }
                if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
                {
                    base.GotoResourceNotFound("商品已经入库");
                }
                if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
                {
                    this.hidUnOnSale.Value = "1";
                }
                this.litSalePrice.Text           = ((wAPProductBrowseInfo.Product.MinSalePrice == wAPProductBrowseInfo.Product.MaxSalePrice) ? wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") : (wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") + "~" + wAPProductBrowseInfo.Product.MaxSalePrice.F2ToString("f2")));
                this.skuSubmitOrder.ProductInfo  = wAPProductBrowseInfo.Product;
                this.skuStoreSubmitOrder.Visible = false;
            }
            if (masterSettings.OpenMultStore)
            {
                if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId))
                {
                    this.hidHasStores.Value      = "1";
                    this.hidCanTakeOnStore.Value = "1";
                }
            }
            else if (masterSettings.IsOpenPickeupInStore && wAPProductBrowseInfo.Product.SupplierId == 0)
            {
                this.hidCanTakeOnStore.Value = "1";
            }
            if (SalesHelper.IsSupportPodrequest() && wAPProductBrowseInfo.Product.SupplierId == 0)
            {
                this.divPodrequest.Visible = true;
            }
            HtmlInputHidden htmlInputHidden2 = this.hidUnAudit;

            num = (int)wAPProductBrowseInfo.Product.AuditStatus;
            htmlInputHidden2.Value = num.ToString();
            if (this.spdiscount != null && HiContext.Current.User.UserId > 0)
            {
                MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(HiContext.Current.User.GradeId);
                this.spdiscount.Visible   = true;
                this.spdiscount.InnerHtml = "<strong class='vip_price'><img src='/templates/pccommon/images/vip_price.png' />" + memberGrade.Name + "价</strong>";
            }
            this.lbUserProductRefer.product = wAPProductBrowseInfo.Product;
            this.hdTitle.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.Title) ? wAPProductBrowseInfo.Product.ProductName : wAPProductBrowseInfo.Product.Title);
            this.hdDesc.Value  = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : wAPProductBrowseInfo.Product.ShortDescription);
            string oldValue = "/storage/master/product/images/";
            string newValue = "/storage/master/product/thumbs410/410_";

            if (!string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1))
            {
                wAPProductBrowseInfo.Product.ImageUrl1 = wAPProductBrowseInfo.Product.ImageUrl1.ToLower().Replace(oldValue, newValue);
            }
            string local = string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) ? SettingsManager.GetMasterSettings().DefaultProductImage : wAPProductBrowseInfo.Product.ImageUrl1;

            this.hdImgUrl.Value = Globals.FullPath(local);
            this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(this.productId);
            }
            if (this.hidden_productId != null)
            {
                this.hidden_productId.Value = this.productId.ToString();
            }
            if (this.promote != null)
            {
                this.promote.ProductId = this.productId;
            }
            MemberInfo user = HiContext.Current.User;

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

            if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null)
            {
                num2 = (user.Referral.IsRepeled ? 1 : 0);
                goto IL_0f0c;
            }
            goto IL_0f0b;
IL_0f0b:
            num2 = 1;
            goto IL_0f0c;
IL_0f0c:
            if (num2 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            bool flag = true;

            if (this.rptProductImages != null)
            {
                string locationUrl = "javascript:;";
                if (string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl2) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl3) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl4) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl5))
                {
                    wAPProductBrowseInfo.Product.ImageUrl1 = masterSettings.DefaultProductImage;
                }
                DataTable         skus = ProductBrowser.GetSkus(this.productId);
                List <SlideImage> list = new List <SlideImage>();
                int supplierId         = wAPProductBrowseInfo.Product.SupplierId;
                if (supplierId > 0)
                {
                    SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                    if (supplierById != null)
                    {
                        this.hidSupplier.Value    = "true";
                        this.litSupplierName.Text = supplierById.SupplierName;
                    }
                }
                else
                {
                    this.hidSupplier.Value = "false";
                    flag = false;
                    this.ulsupplier.Style.Add(HtmlTextWriterStyle.Display, "none");
                }
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl1, locationUrl));
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl2, locationUrl));
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl3, locationUrl));
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl4, locationUrl));
                list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl5, locationUrl));
                this.rptProductImages.DataSource = from item in list
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.Text = wAPProductBrowseInfo.Product.ProductName;
            if (wAPProductBrowseInfo.Product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(wAPProductBrowseInfo.Product.MarketPrice.GetValueOrDefault(decimal.Zero).F2ToString("f2"));
            }
            this.litShortDescription.Text    = wAPProductBrowseInfo.Product.ShortDescription;
            this.divShortDescription.Visible = !string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription);
            if (wAPProductBrowseInfo.Product.IsRefund)
            {
                this.lit_IsRefund.Text     = "<img src=\"/templates/common/images/service_gou.png\" /><span class=\"c-green\">随时退</span>";
                this.lit_IsOverRefund.Text = (wAPProductBrowseInfo.Product.IsOverRefund ? "" : "<img src=\"/templates/common/images/service_cha.png\" /><span class=\"c-orange\">过期不退</span>");
            }
            else
            {
                this.lit_IsRefund.Text = "<img src=\"/templates/common/images/service_cha.png\" /><span class=\"c-orange\">不可退</span>";
            }
            if (!wAPProductBrowseInfo.Product.IsValid)
            {
                if (wAPProductBrowseInfo.Product.ValidStartDate.HasValue && wAPProductBrowseInfo.Product.ValidEndDate.HasValue)
                {
                    Literal  literal = this.lit_RefundTime;
                    DateTime value   = wAPProductBrowseInfo.Product.ValidStartDate.Value;
                    string   arg     = value.ToString("yyyy/MM/dd");
                    value        = wAPProductBrowseInfo.Product.ValidEndDate.Value;
                    literal.Text = string.Format("{0}-{1}", arg, value.ToString("yyyy/MM/dd"));
                }
            }
            else
            {
                this.lit_RefundTime.Text = "长期有效";
            }
            if (this.litDescription != null)
            {
                string text  = "";
                Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.MobbileDescription))
                {
                    text = regex.Replace(wAPProductBrowseInfo.Product.MobbileDescription, "");
                }
                else if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.Description))
                {
                    text = regex.Replace(wAPProductBrowseInfo.Product.Description, "");
                }
                text = text.Replace("src", "data-url");
                text = text.Replace("vurl", "src");
                this.litDescription.Text = text;
            }
            Literal control = this.litSoldCount;

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

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

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

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

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

            if (!string.IsNullOrEmpty(phonePriceByProductId))
            {
                this.divPhonePrice.Visible = true;
                decimal num3 = phonePriceByProductId.Split(',')[0].ToDecimal(0);
                this.litPhonePrice.Text = num3.F2ToString("f2");
                decimal num4 = wAPProductBrowseInfo.Product.MinSalePrice - num3;
                this.litSalePrice.Text = ((num4 > decimal.Zero) ? num4 : decimal.Zero).F2ToString("f2");
                this.lbUserProductRefer.MobileExclusive = num3;
            }
            if (flag || this.liOrderPromotions.Visible || this.liOrderPromotions_free2.Visible || this.liProductSendGifts.Visible || this.rptCouponList.Visible)
            {
                this.divActivities.Visible = true;
            }
            else
            {
                this.divActivities.Visible = false;
            }
            StoresInfo storeById = StoresHelper.GetStoreById(this.storeId);

            if (storeById != null)
            {
                this.ProcessException(storeById);
            }
        }
示例#27
0
        private void BindOrderInfo()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

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

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

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

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

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

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

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

            paymentTypeId = (int)this.order.OrderStatus;
            control2.SetWhenIsNotNull(paymentTypeId.ToString());
            this.hidOrderId.SetWhenIsNotNull(this.orderId.ToString());
            this.litPaymentMode.SetWhenIsNotNull(this.order.PaymentType);
            this.litShipToDate.SetWhenIsNotNull(this.order.ShipToDate);
            if (this.order.PreSaleId > 0)
            {
                this.litBuildPrice.SetWhenIsNotNull((this.order.Deposit + this.order.FinalPayment).F2ToString("f2"));
            }
            else
            {
                this.litBuildPrice.SetWhenIsNotNull(this.order.GetPayTotal().F2ToString("f2"));
            }
            this.litRemark.SetWhenIsNotNull(this.order.Remark);
            this.litTakeCode.SetWhenIsNotNull((this.order.ShippingModeId == -2) ? this.order.TakeCode : "");
            this.litFreight.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.litFreight2.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.litFullCapacityReduction.SetWhenIsNotNull("-" + this.order.ReducedPromotionAmount.F2ToString("f2"));
            if (this.order.PreSaleId > 0)
            {
                if (productPreSaleInfo == null)
                {
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                }
                nullable = this.order.DepositDate;
                if (!nullable.HasValue)
                {
                    this.hidpresaleStaut.Value = "1";
                    if (this.order.OrderStatus == OrderStatus.Closed)
                    {
                        this.hidpresaleStaut.Value = "6";
                    }
                }
                else if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                {
                    this.hidpresaleStaut.Value = "2";
                }
                else if (productPreSaleInfo.PaymentEndDate < DateTime.Now)
                {
                    if (this.order.PayDate == DateTime.MinValue)
                    {
                        this.hidpresaleStaut.Value = "5";
                    }
                    else
                    {
                        this.hidpresaleStaut.Value = "4";
                    }
                }
                else if (this.order.PayDate == DateTime.MinValue)
                {
                    this.hidpresaleStaut.Value = "3";
                }
                else
                {
                    this.hidpresaleStaut.Value = "4";
                }
            }
        }
        public void bindReplaceInfo()
        {
            int         replaceId   = this.Page.Request["replaceId"].ToInt(0);
            ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId);
            OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(replaceInfo.OrderId);

            if (replaceInfo == null)
            {
                this.ShowMsg("换货信息错误!", false);
            }
            else
            {
                HiddenField hiddenField = this.hidReplaceStatus;
                int         num         = (int)replaceInfo.HandleStatus;
                hiddenField.Value = num.ToString();
                if (orderInfo == null)
                {
                    this.ShowMsg("错误的订单信息!", false);
                }
                else if (orderInfo.StoreId != this.UserStoreId)
                {
                    this.ShowMsg("不是门店的订单不能进行处理", false);
                }
                else
                {
                    if (string.IsNullOrEmpty(replaceInfo.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 == replaceInfo.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 = replaceInfo.ReplaceReason;
                    this.litRemark.Text       = replaceInfo.UserRemark;
                    Literal literal = this.litReturnQuantity;
                    num                      = replaceInfo.Quantity;
                    literal.Text             = num.ToString();
                    this.txtAdminRemark.Text = replaceInfo.AdminRemark;
                    string userCredentials = replaceInfo.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 (replaceInfo.HandleStatus == ReplaceStatus.Applied && this.UserStoreId == orderInfo.StoreId)
                    {
                        this.btnAcceptReplace.Visible = true;
                        this.btnRefuseReplace.Visible = true;
                    }
                    else if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery)
                    {
                        this.btnGetAndSendGoods.Visible = true;
                    }
                    if (replaceInfo.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      = replaceInfo.AdminCellPhone;
                        this.litAdminShipTo.Text         = replaceInfo.AdminShipTo;
                        this.litAdminShipAddrss.Text     = replaceInfo.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));
                        }
                    }
                    string str2 = string.IsNullOrEmpty(orderInfo.RealName) ? "" : (orderInfo.RealName.Replace("\n\r", "").Replace("\n", "").Replace("\r", "") + " (" + (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone) + ")");
                    str2 = str2 + orderInfo.ShippingRegion + " " + orderInfo.Address;
                    this.litUserAddress.Text = str2;
                    this.txtStatus.Text      = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 0);
                    Literal literal5 = this.txtAfterSaleId;
                    num           = replaceInfo.ReplaceId;
                    literal5.Text = num.ToString();
                    if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery)
                    {
                        this.btnViewUserLogistic.Visible = true;
                        AttributeCollection attributes = this.btnViewUserLogistic.Attributes;
                        num = replaceInfo.ReplaceId;
                        attributes.Add("replaceid", num.ToString());
                        this.btnViewUserLogistic.Attributes.Add("expresscompanyname", replaceInfo.UserExpressCompanyName.ToString());
                        this.btnViewUserLogistic.Attributes.Add("shipordernumber", replaceInfo.UserShipOrderNumber.ToString());
                    }
                    if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced)
                    {
                        this.btnViewMallLogistic.Visible = true;
                        AttributeCollection attributes2 = this.btnViewMallLogistic.Attributes;
                        num = replaceInfo.ReplaceId;
                        attributes2.Add("replaceid", num.ToString());
                        this.btnViewMallLogistic.Attributes.Add("expresscompanyname", replaceInfo.ExpressCompanyName.ToString());
                        this.btnViewMallLogistic.Attributes.Add("shipordernumber", replaceInfo.ShipOrderNumber.ToString());
                    }
                }
            }
        }
示例#29
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");
        }
示例#30
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();
            }
        }