Ejemplo n.º 1
0
 protected void btnAddAddress_Click(object sender, System.EventArgs e)
 {
     if (!this.ValShippingAddress())
     {
         return;
     }
     if (!string.IsNullOrEmpty(txtShippingId.Text))
     {
         ShippingAddressInfo shippingAddressInfo = this.GetShippingAddressInfo();
         shippingAddressInfo.ShippingId = System.Convert.ToInt32(this.ViewState["shippingId"]);
         if (txtShippingId != null)
         {
             txtShippingId.Text = shippingAddressInfo.ShippingId.ToString();
         }
         if (MemberProcessor.UpdateShippingAddress(shippingAddressInfo))
         {
             this.ShowMessage("成功的修改了一个收货地址", true);
             //this.btnAddAddress.Text = "添加";
             //txtShippingId.Text = "";
             //this.Reset();
             this.Page.Response.Redirect("UserShippingAddresses.aspx");
             return;
         }
         else
         {
             this.ShowMessage("地址已经在,请重新输入一次再试", false);
             return;
         }
     }
     else
     {
         int shippingAddressCount = MemberProcessor.GetShippingAddressCount();
         if (shippingAddressCount >= HiContext.Current.Config.ShippingAddressQuantity)
         {
             this.ShowMessage(string.Format("最多只能添加{0}个收货地址", HiContext.Current.Config.ShippingAddressQuantity), false);
             this.Reset();
             return;
         }
         ShippingAddressInfo shippingAddressInfo2 = this.GetShippingAddressInfo();
         if (shippingAddressCount == 0)
         {
             shippingAddressInfo2.IsDefault = true;
         }
         if (MemberProcessor.AddShippingAddress(shippingAddressInfo2) > 0)
         {
             this.ShowMessage("成功的添加了一个收货地址", true);
             //this.Reset();
             this.Page.Response.Redirect("UserShippingAddresses.aspx");
             return;
         }
         else
         {
             this.ShowMessage("地址已经在,请重新输入一次再试", false);
             return;
         }
     }
     this.BindList();
 }
Ejemplo n.º 2
0
        private void AddUserShippingAddress(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string str = "";

            if (!this.ValShippingAddress(context, ref str))
            {
                context.Response.Write("{\"Status\":\"Error\",\"Result\":\"" + str + "\"}");
                return;
            }
            ShippingAddressInfo shippingAddressInfo = this.GetShippingAddressInfo(context);
            int shippingId = MemberProcessor.AddShippingAddress(shippingAddressInfo);

            if (shippingId > 0)
            {
                //System.Collections.Generic.IList<ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
                //shippingAddressInfo = shippingAddresses[shippingAddresses.Count - 1];
                shippingAddressInfo.ShippingId = shippingId;
                string        fullAddress   = RegionHelper.GetFullRegion(shippingAddressInfo.RegionId, " ");
                StringBuilder stringBuilder = new StringBuilder();

                context.Response.Write(string.Concat(new object[]
                {
                    "{\"Status\":\"OK\",\"Result\":{\"ShipTo\":\"",
                    shippingAddressInfo.ShipTo,
                    "\",\"RegionId\":\"",
                    fullAddress,
                    "\",\"ShippingAddress\":\"",
                    shippingAddressInfo.Address,
                    "\",\"ShippingId\":\"",
                    shippingAddressInfo.ShippingId,
                    "\",\"CellPhone\":\"",
                    shippingAddressInfo.CellPhone,
                    "\",\"AddressList\":\"",
                    "",
                    "\"}}"
                }));
                return;
            }
            context.Response.Write("{\"Status\":\"Error\",\"Result\":\"地址已经在,请重新输入一次再试\"}");
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int num = 0;
            SortedDictionary <string, string> requestPost = this.GetRequestPost();

            if (requestPost.Count > 0)
            {
                string            openIdType     = "hishop.plugins.openid.alipay.alipayservice";
                OpenIdSettingInfo openIdSettings = OpenIdHelper.GetOpenIdSettings(openIdType);
                if (openIdSettings == null)
                {
                    base.Response.Write("登录失败,没有找到对应的插件配置信息。");
                    return;
                }
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.XmlResolver = null;
                xmlDocument.LoadXml(HiCryptographer.Decrypt(openIdSettings.Settings));
                AliPayNotify aliPayNotify = new AliPayNotify(requestPost, base.Request.Form["notify_id"], xmlDocument.FirstChild.SelectSingleNode("Partner").InnerText, xmlDocument.FirstChild.SelectSingleNode("Key").InnerText);
                string       responseTxt  = aliPayNotify.ResponseTxt;
                string       a            = base.Request.Form["sign"];
                string       mysign       = aliPayNotify.Mysign;
                if (responseTxt == "true" && a == mysign)
                {
                    string text = base.Request.Form["receive_address"];
                    if (!string.IsNullOrEmpty(text))
                    {
                        XmlDocument xmlDocument2 = new XmlDocument();
                        xmlDocument.XmlResolver = null;
                        xmlDocument2.LoadXml(text);
                        ShippingAddressInfo shippingAddressInfo = new ShippingAddressInfo();
                        shippingAddressInfo.UserId = HiContext.Current.UserId;
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/address") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/address").InnerText))
                        {
                            shippingAddressInfo.Address = Globals.HtmlEncode(xmlDocument2.SelectSingleNode("/receiveAddress/address").InnerText);
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/fullname") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/fullname").InnerText))
                        {
                            shippingAddressInfo.ShipTo = Globals.HtmlEncode(xmlDocument2.SelectSingleNode("/receiveAddress/fullname").InnerText);
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/post") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/post").InnerText))
                        {
                            shippingAddressInfo.Zipcode = xmlDocument2.SelectSingleNode("/receiveAddress/post").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText))
                        {
                            shippingAddressInfo.CellPhone = xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/phone") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/phone").InnerText))
                        {
                            shippingAddressInfo.TelPhone = xmlDocument2.SelectSingleNode("/receiveAddress/phone").InnerText;
                        }
                        string text2 = string.Empty;
                        string text3 = string.Empty;
                        string text4 = string.Empty;
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/area") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/area").InnerText))
                        {
                            text2 = xmlDocument2.SelectSingleNode("/receiveAddress/area").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/city") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/city").InnerText))
                        {
                            text3 = xmlDocument2.SelectSingleNode("/receiveAddress/city").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/prov") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/prov").InnerText))
                        {
                            text4 = xmlDocument2.SelectSingleNode("/receiveAddress/prov").InnerText;
                        }
                        if (string.IsNullOrEmpty(text2) && string.IsNullOrEmpty(text3) && string.IsNullOrEmpty(text4))
                        {
                            shippingAddressInfo.RegionId = 0;
                        }
                        else
                        {
                            shippingAddressInfo.RegionId = RegionHelper.GetRegionId(text2, text3, text4);
                        }
                        SiteSettings siteSettings = HiContext.Current.SiteSettings;
                        if (MemberProcessor.GetShippingAddressCount(HiContext.Current.UserId) < HiContext.Current.Config.ShippingAddressQuantity)
                        {
                            shippingAddressInfo.FullRegionPath = RegionHelper.GetFullPath(shippingAddressInfo.RegionId, true);
                            num = MemberProcessor.AddShippingAddress(shippingAddressInfo);
                        }
                    }
                }
            }
            this.Page.Response.Redirect("/SubmmitOrder.aspx?shippingId=" + num);
        }