/// <summary>
        /// 修改收货地址
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public object PostUpdateAddress(ShippingAddressOperaAddressPModel value)
        {
            CheckUserLogin();
            CheckUserLogin();
            ShippingAddressInfo shippingAddr = new ShippingAddressInfo();

            shippingAddr.UserId   = CurrentUser.Id;
            shippingAddr.Id       = value.shippingId;
            shippingAddr.RegionId = value.regionId;
            shippingAddr.Address  = value.address;
            shippingAddr.Phone    = value.cellphone;
            shippingAddr.ShipTo   = value.shipTo;
            try
            {
                ServiceProvider.Instance <IShippingAddressService> .Create.UpdateShippingAddress(shippingAddr);

                if (value.isDefault)
                {
                    ServiceProvider.Instance <IShippingAddressService> .Create.SetDefaultShippingAddress(shippingAddr.Id, CurrentUserId);
                }
            }
            catch (Exception ex)
            {
                return(Json(new { Status = "NO", Message = ex.Message }));
            }
            return(Json(new { Status = "OK", Message = shippingAddr.Id }));
        }
Exemple #2
0
        public int AddOrUpdateShippingAddress(ShippingAddressInfo shippingAddress, int newUserId, out int newShippingId)
        {
            int result = 0;

            newShippingId = 0;
            DbCommand storedProcCommand = this.database.GetStoredProcCommand("cp_AddOrUpdateShippingAddress");

            this.database.AddInParameter(storedProcCommand, "ShippingId", DbType.Int32, shippingAddress.ShippingId);
            this.database.AddInParameter(storedProcCommand, "RegionId", DbType.Int32, shippingAddress.RegionId);
            this.database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, shippingAddress.UserId);
            this.database.AddInParameter(storedProcCommand, "ShipTo", DbType.String, shippingAddress.ShipTo);
            this.database.AddInParameter(storedProcCommand, "Address", DbType.String, shippingAddress.Address);
            this.database.AddInParameter(storedProcCommand, "Zipcode", DbType.String, shippingAddress.Zipcode);
            this.database.AddInParameter(storedProcCommand, "TelPhone", DbType.String, shippingAddress.TelPhone);
            this.database.AddInParameter(storedProcCommand, "CellPhone", DbType.String, shippingAddress.CellPhone);
            this.database.AddInParameter(storedProcCommand, "IsDefault", DbType.Int32, shippingAddress.IsDefault);
            this.database.AddInParameter(storedProcCommand, "IdentityCard", DbType.String, shippingAddress.IdentityCard);
            this.database.AddInParameter(storedProcCommand, "NewUserId", DbType.Int32, newUserId);
            this.database.AddOutParameter(storedProcCommand, "NewShippingId", DbType.Int32, 4);

            result = this.database.ExecuteNonQuery(storedProcCommand);

            int.TryParse(this.database.GetParameterValue(storedProcCommand, "NewShippingId").ToString(), out newShippingId);

            return(result);
        }
        //议价 详细页面
        public ActionResult BargainDetail(long id)
        {
            string      isreview     = "false";
            MargainBill _MargainBill = ServiceHelper.Create <IMargainBillService>().GetBillById(id, base.CurrentUser.Id);

            _MargainBill.MemberName = ServiceHelper.Create <IMemberService>().GetMember(_MargainBill.MemberId).RealName == null ? "" : ServiceHelper.Create <IMemberService>().GetMember(_MargainBill.MemberId).RealName;
            _MargainBill.ShopName   = ServiceHelper.Create <IShopService>().GetShop(_MargainBill.ShopId).ShopName == null ? "" : ServiceHelper.Create <IShopService>().GetShop(_MargainBill.ShopId).ShopName;
            foreach (var item in _MargainBill._MargainBillDetail)
            {
                item.BidderName = ServiceHelper.Create <IMemberService>().GetMember(item.Bidder) == null?ServiceHelper.Create <IShopService>().GetShopName(item.Bidder) : ServiceHelper.Create <IMemberService>().GetMember(item.Bidder).RealName;
            }
            if (_MargainBill.BillStatus == EnumBillStatus.Bargaining)
            {
                isreview = "true";
            }
            ViewBag.CurrentUser = base.CurrentUser.Id;
            ViewBag.isreview    = isreview;
            if (!string.IsNullOrEmpty(_MargainBill.DeliverAddress) && !"null".Equals(_MargainBill.DeliverAddress))
            {
                ShippingAddressInfo addressinfo = ServiceHelper.Create <IShippingAddressService>().GetUserShippingAddress(long.Parse(_MargainBill.DeliverAddress));
                if (addressinfo != null)
                {
                    _MargainBill.DeliverAddress = addressinfo.RegionFullName + ">" + addressinfo.Address;
                }
            }
            else
            {
                _MargainBill.DeliverAddress = "" + ">" + "";
            }
            return(View(_MargainBill));
        }
Exemple #4
0
        /// <summary>
        /// 获取用户配送地址
        /// </summary>
        /// <param name="context"></param>
        void GetUserShippingAddress(HttpContext context)
        {
            ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(int.Parse(context.Request["ShippingId"], NumberStyles.None));

            StringBuilder builder = new StringBuilder();

            builder.Append("{");
            if (shippingAddress != null)
            {
                builder.Append("\"Status\":\"OK\",");
                builder.AppendFormat("\"ShipTo\":\"{0}\",", Globals.HtmlDecode(shippingAddress.ShipTo));
                builder.AppendFormat("\"Address\":\"{0}\",", Globals.HtmlDecode(shippingAddress.Address));
                builder.AppendFormat("\"Zipcode\":\"{0}\",", Globals.HtmlDecode(shippingAddress.Zipcode));
                builder.AppendFormat("\"CellPhone\":\"{0}\",", Globals.HtmlDecode(shippingAddress.CellPhone));
                builder.AppendFormat("\"TelPhone\":\"{0}\",", Globals.HtmlDecode(shippingAddress.TelPhone));
                builder.AppendFormat("\"RegionId\":\"{0}\"", shippingAddress.RegionId);
            }
            else
            {
                builder.Append("\"Status\":\"0\"");
            }

            builder.Append("}");

            context.Response.ContentType = "text/plain";

            context.Response.Write(builder);
        }
Exemple #5
0
        public virtual void UpdateShippingAddress(ShippingAddressInfo shippingAddress)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("UpdateShippingAddress");

            cmd.SetParameterValue <ShippingAddressInfo>(shippingAddress);
            cmd.ExecuteNonQuery();
        }
Exemple #6
0
 protected void btnAddAddress_Click(object sender, System.EventArgs e)
 {
     if (this.ValShippingAddress())
     {
         if (PersonalHelper.GetShippingAddressCount(HiContext.Current.User.UserId) >= HiContext.Current.Config.ShippingAddressQuantity)
         {
             this.ShowMessage(string.Format("最多只能添加{0}个收货地址", HiContext.Current.Config.ShippingAddressQuantity), false);
             this.Reset();
         }
         else
         {
             ShippingAddressInfo shippingAddressInfo = this.GetShippingAddressInfo();
             if (PersonalHelper.CreateShippingAddress(shippingAddressInfo))
             {
                 this.ShowMessage("成功的添加了一个收货地址", true);
                 this.Reset();
             }
             else
             {
                 this.ShowMessage("地址已经在,请重新输入一次再试", false);
             }
             this.BindList();
         }
     }
 }
        public JsonResult GetShippingAddress(long id)
        {
            ShippingAddressInfo userShippingAddress = ServiceHelper.Create <IShippingAddressService>().GetUserShippingAddress(id);
            var variable = new { id = userShippingAddress.Id, fullRegionName = userShippingAddress.RegionFullName, address = userShippingAddress.Address, phone = userShippingAddress.Phone, shipTo = userShippingAddress.ShipTo, fullRegionIdPath = userShippingAddress.RegionIdPath };

            return(Json(variable));
        }
Exemple #8
0
        public static ShippingAddressInfo PopulateShippingAddress(IDataRecord reader)
        {
            if (reader == null)
            {
                return(null);
            }
            ShippingAddressInfo info = new ShippingAddressInfo {
                ShippingId = (int)reader["ShippingId"],
                ShipTo     = (string)reader["ShipTo"],
                RegionId   = (int)reader["RegionId"],
                UserId     = (int)reader["UserId"],
                Address    = (string)reader["Address"],
                Zipcode    = (string)reader["Zipcode"],
                IsDefault  = (bool)reader["IsDefault"]
            };

            if (reader["TelPhone"] != DBNull.Value)
            {
                info.TelPhone = (string)reader["TelPhone"];
            }
            if (reader["CellPhone"] != DBNull.Value)
            {
                info.CellPhone = (string)reader["CellPhone"];
            }
            return(info);
        }
Exemple #9
0
        public object GetShippingAddress(long id)
        {
            CheckUserLogin();
            var shoppingAddress = ServiceProvider.Instance <IShippingAddressService> .Create.GetUserShippingAddressByUserId(CurrentUser.Id);

            var shopaddressInfo = shoppingAddress.FirstOrDefault(e => e.Id == id);

            if (shopaddressInfo != null)
            {
                var model = new ShippingAddressInfo()
                {
                    Id             = shopaddressInfo.Id,
                    ShipTo         = shopaddressInfo.ShipTo,
                    Phone          = shopaddressInfo.Phone,
                    RegionFullName = shopaddressInfo.RegionFullName,
                    Address        = shopaddressInfo.Address,
                    RegionId       = shopaddressInfo.RegionId,
                    RegionIdPath   = shopaddressInfo.RegionIdPath,
                    Latitude       = shopaddressInfo.Latitude,
                    Longitude      = shopaddressInfo.Longitude
                };
                return(Json(new { Success = "true", ShippingAddress = model }));
            }
            else
            {
                return(Json(new { Success = "true", ShippingAddress = new ShippingAddressInfo() }));
            }
        }
Exemple #10
0
        public static bool DeleteShippingAddress(int shippingId)
        {
            ShippingAddressInfo shippingAddress = new ShippingAddressInfo();

            shippingAddress.ShippingId = shippingId;
            return(PersonalProvider.Instance().CreateUpdateDeleteShippingAddress(shippingAddress, DataProviderAction.Delete));
        }
Exemple #11
0
        public void UpdateShippingAddress(ShippingAddressVM data, EventHandler <RestClientEventArgs <ShippingAddressInfo> > callback)
        {
            string relativeUrl      = "/CustomerService/ShippingAddress/Update";
            ShippingAddressInfo msg = data.ConvertVM <ShippingAddressVM, ShippingAddressInfo>();

            restClient.Update <ShippingAddressInfo>(relativeUrl, msg, callback);
        }
Exemple #12
0
 protected override void AttachChildControls()
 {
     this.inputPaymentModeId      = (HtmlInputHidden)this.FindControl("inputPaymentModeId");
     this.inputShippingModeId     = (HtmlInputHidden)this.FindControl("inputShippingModeId");
     this.hidPaymentId_Podrequest = (HtmlInputHidden)this.FindControl("hidPaymentId_Podrequest");
     this.hidGetgoodsOnStores     = (HtmlInputHidden)this.FindControl("hidGetgoodsOnStores");
     this.hidDeliveryTime         = (HtmlInputHidden)this.FindControl("hidDeliveryTime");
     this.hidStoreId       = (HtmlInputHidden)this.FindControl("hidStoreId");
     this.hidShipAddressId = (HtmlInputHidden)this.FindControl("hidShipAddressId");
     this.rptStores        = (AppshopTemplatedRepeater)this.FindControl("rptStores");
     if (!this.Page.IsPostBack)
     {
         this.hidGetgoodsOnStores.Value     = "false";
         this.hidPaymentId_Podrequest.Value = "0";
         int num = 0;
         if (this.from != "countdown" && this.from != "groupbuy" && SalesHelper.IsSupportPodrequest())
         {
             num = 1;
             this.hidPaymentId_Podrequest.Value = "1";
         }
         if (this.paymentModeId != 0 && this.paymentModeId != num && this.paymentModeId != -3)
         {
             this.paymentModeId = 0;
         }
         this.hidDeliveryTime.Value     = this.deliveryTime;
         this.inputPaymentModeId.Value  = this.paymentModeId.ToString();
         this.inputShippingModeId.Value = this.shippingModeId.ToString();
         this.hidStoreId.Value          = this.storeId.ToString();
         int shipAddressId = 0;
         int.TryParse(this.Page.Request.QueryString["ShipAddressId"].ToNullString(), out shipAddressId);
         IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(false);
         int num2 = 0;
         IList <ShippingAddressInfo> list = new List <ShippingAddressInfo>();
         ShippingAddressInfo         shippingAddressInfo = null;
         string address = "";
         if (shipAddressId > 0)
         {
             shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo a) => a.ShippingId == shipAddressId);
             if (shippingAddressInfo != null)
             {
                 num2    = shippingAddressInfo.RegionId;
                 address = shippingAddressInfo.FullAddress;
             }
         }
         else if (shippingAddresses != null && shippingAddresses.Count > 0)
         {
             num2 = shippingAddresses.FirstOrDefault().RegionId;
         }
         this.hidShipAddressId.Value = shipAddressId.ToString();
         StoresQuery storesQuery = new StoresQuery();
         storesQuery.RegionID    = num2;
         storesQuery.RegionName  = RegionHelper.GetFullRegion(num2, " ", true, 0);
         storesQuery.State       = 1;
         storesQuery.CloseStatus = 1;
         DataTable storeList = StoresHelper.GetStoreList(this.newProductSku, num2, address, this.buyAmount);
         this.rptStores.DataSource = storeList;
         this.rptStores.DataBind();
         PageTitle.AddSiteNameTitle("门店选择");
     }
 }
        public object GetShippingAddress(long id)
        {
            CheckUserLogin();
            var shoppingAddress = ServiceProvider.Instance <IShippingAddressService> .Create.GetUserShippingAddressByUserId(CurrentUser.Id);

            var shopaddressInfo = shoppingAddress.FirstOrDefault(e => e.Id == id);

            if (shopaddressInfo != null)
            {
                var model = new ShippingAddressInfo()
                {
                    Id             = shopaddressInfo.Id,
                    ShipTo         = shopaddressInfo.ShipTo,
                    Phone          = shopaddressInfo.Phone,
                    RegionFullName = shopaddressInfo.RegionFullName,
                    Address        = shopaddressInfo.Address,
                    RegionId       = shopaddressInfo.RegionId,
                    RegionIdPath   = shopaddressInfo.RegionIdPath,
                    Latitude       = shopaddressInfo.Latitude,
                    Longitude      = shopaddressInfo.Longitude,
                    AddressDetail  = shopaddressInfo.AddressDetail == null ? string.Empty : shopaddressInfo.AddressDetail
                };
                dynamic result = SuccessResult();
                result.ShippingAddress = model;
                return(result);
            }
            else
            {
                dynamic result = SuccessResult();
                result.ShippingAddress = new ShippingAddressInfo();
                return(result);
            }
        }
Exemple #14
0
        protected override void AttachChildControls()
        {
            this.litShipTo    = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litCellPhone = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
            this.litAddress   = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.rptAddress   = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
            this.rptAddress.DataSource = from item in shippingAddresses
                                         orderby item.IsDefault
                                         select item;

            this.rptAddress.DataBind();
            this.litAddAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddAddress");
            this.selectShipTo  = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo");
            this.regionId      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId");
            ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault);

            if (shippingAddressInfo == null)
            {
                shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null);
            }
            if (shippingAddressInfo != null)
            {
                this.litShipTo.Text    = shippingAddressInfo.ShipTo;
                this.litCellPhone.Text = shippingAddressInfo.CellPhone;
                this.litAddress.Text   = shippingAddressInfo.Address;
                this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString());
                this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString());
            }
            this.litAddAddress.Text = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()) + "'";
            PageTitle.AddSiteNameTitle("中奖记录");
        }
Exemple #15
0
        public bool UpdateShippingAddress(ShippingAddressInfo shippingAddress)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update Hishop_UserShippingAddresses");
            builder.Append(" set ShipTo=@ShipTo,");
            builder.Append("Address=@Address,");
            builder.Append("Zipcode=@Zipcode,");
            builder.Append("TelPhone=@TelPhone,");
            builder.Append("CellPhone=@CellPhone,");
            builder.Append(" RegionId=@RegionId");
            builder.Append(" where shippingId=@shippingId");
            builder.Append(" and UserId=@UserId");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "RegionId", DbType.Int32, shippingAddress.RegionId);
            this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, shippingAddress.UserId);
            this.database.AddInParameter(sqlStringCommand, "ShipTo", DbType.String, shippingAddress.ShipTo);
            this.database.AddInParameter(sqlStringCommand, "Address", DbType.String, shippingAddress.Address);
            this.database.AddInParameter(sqlStringCommand, "Zipcode", DbType.String, shippingAddress.Zipcode);
            this.database.AddInParameter(sqlStringCommand, "TelPhone", DbType.String, shippingAddress.TelPhone);
            this.database.AddInParameter(sqlStringCommand, "CellPhone", DbType.String, shippingAddress.CellPhone);
            this.database.AddInParameter(sqlStringCommand, "shippingId", DbType.Int32, shippingAddress.ShippingId);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
        private ShippingAddressInfo GetShippingAddress(long?regionId)
        {
            ShippingAddressInfo shippingAddressInfo = null;

            shippingAddressInfo = (!regionId.HasValue ? ServiceHelper.Create <IShippingAddressService>().GetDefaultUserShippingAddressByUserId(base.CurrentUser.Id) : ServiceHelper.Create <IShippingAddressService>().GetUserShippingAddress(regionId.Value));
            return(shippingAddressInfo);
        }
Exemple #17
0
        public object GetShippingAddressList()
        {
            CheckUserLogin();
            var shoppingAddress = ServiceProvider.Instance <IShippingAddressService> .Create.GetUserShippingAddressByUserId(CurrentUser.Id);

            var shippingAddressList = new List <ShippingAddressInfo>();

            foreach (var item in shoppingAddress)
            {
                ShippingAddressInfo shippingAddress = new ShippingAddressInfo()
                {
                    Id             = item.Id,
                    ShipTo         = item.ShipTo,
                    Phone          = item.Phone,
                    RegionFullName = item.RegionFullName,
                    Address        = item.Address,
                    RegionId       = item.RegionId,
                    RegionIdPath   = item.RegionIdPath,
                    IsDefault      = item.IsDefault,
                    Latitude       = item.Latitude,
                    Longitude      = item.Longitude
                };
                shippingAddressList.Add(shippingAddress);
            }
            return(Json(new { Success = "true", ShippingAddress = shippingAddressList }));
        }
Exemple #18
0
        /// <summary>
        /// 计算运费,海美生活海购运费计算方式
        /// </summary>
        /// <param name="shoppingCartItemInfo">购物车信息</param>
        /// <param name="shippingAddressInfo">收货地址</param>
        /// <param name="isGroupBuy"></param>
        /// <returns>返回运费</returns>
        public static decimal GetFreight(ShoppingCartInfo shoppingCartItemInfo, ShippingAddressInfo shippingAddressInfo, bool isGroupBuy)
        {
            int     totalQuantity = 0;
            decimal freight       = 0;
            Dictionary <int, decimal> dictShippingMode = new Dictionary <int, decimal>();

            foreach (ShoppingCartItemInfo item in shoppingCartItemInfo.LineItems)
            {
                totalQuantity += item.Quantity;
                if ((!shoppingCartItemInfo.IsFreightFree || !item.IsfreeShipping || isGroupBuy))
                {
                    if (item.TemplateId > 0)
                    {
                        if (dictShippingMode.ContainsKey(item.TemplateId))
                        {
                            dictShippingMode[item.TemplateId] += item.Weight * item.Quantity;
                        }
                        else
                        {
                            dictShippingMode.Add(item.TemplateId, item.Weight * item.Quantity);
                        }
                    }
                }
            }
            foreach (var item in dictShippingMode)
            {
                ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(item.Key);
                freight += ShoppingProcessor.CalcFreight(shippingAddressInfo.RegionId, item.Value, shippingMode);
            }
            return(freight);
        }
Exemple #19
0
        protected void btnEditAddress_Click(object sender, System.EventArgs e)
        {
            if (!this.ValShippingAddress())
            {
                return;
            }
            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);
                txtShippingId.Text = "";
                this.Reset();
            }
            else
            {
                this.ShowMessage("地址已经在,请重新输入一次再试", false);
            }
            this.btnAddAddress.Visible = true;
            this.BindList();
        }
Exemple #20
0
 protected void dtlstRegionsSelect_ItemCommand(object source, DataListCommandEventArgs e)
 {
     shippingId = (int)this.dtlstRegionsSelect.DataKeys[e.Item.ItemIndex];
     this.ViewState["shippingId"] = shippingId;
     if (e.CommandName == "Edit")
     {
         ShippingAddressInfo userShippingAddress = PersonalHelper.GetUserShippingAddress(shippingId);
         if (userShippingAddress != null)
         {
             this.txtShipTo.Text = userShippingAddress.ShipTo;
             this.dropRegionsSelect.SetSelectedRegionId(new int?(userShippingAddress.RegionId));
             this.txtAddress.Text        = userShippingAddress.Address;
             this.txtZipcode.Text        = userShippingAddress.Zipcode;
             this.txtTelPhone.Text       = userShippingAddress.TelPhone;
             this.txtCellPhone.Text      = userShippingAddress.CellPhone;
             this.btnCancel.Visible      = true;
             this.btnAddAddress.Visible  = false;
             this.btnEditAddress.Visible = true;
         }
     }
     if (e.CommandName == "Delete")
     {
         if (PersonalHelper.DeleteShippingAddress(shippingId))
         {
             this.ShowMessage("成功的删除了你要删除的记录", true);
             this.BindList();
         }
         else
         {
             this.ShowMessage("删除失败", false);
         }
         shippingId = 0;
     }
 }
Exemple #21
0
        protected void dtlstRegionsSelect_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            int num = System.Convert.ToInt32(e.CommandArgument);

            if (txtShippingId != null)
            {
                txtShippingId.Text = num.ToString();
            }
            this.ViewState["shippingId"] = num;
            if (e.CommandName == "Edit")
            {
                ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(num);
                if (shippingAddress != null)
                {
                    this.txtShipTo.Text = shippingAddress.ShipTo;
                    this.dropRegionsSelect.SetSelectedRegionId(new int?(shippingAddress.RegionId));
                    this.txtAddress.Text   = shippingAddress.Address;
                    this.txtZipcode.Text   = shippingAddress.Zipcode;
                    this.txtTelPhone.Text  = shippingAddress.TelPhone;
                    this.txtCellPhone.Text = shippingAddress.CellPhone;

                    this.btnAddAddress.Text = "保存";
                    return;
                }
            }
            if (e.CommandName == "Delete")
            {
                if (MemberProcessor.DelShippingAddress(num, HiContext.Current.User.UserId))
                {
                    this.ShowMessage("成功的删除了你要删除的记录", true);
                    this.txtShipTo.Text    = string.Empty;
                    this.txtAddress.Text   = string.Empty;
                    this.txtZipcode.Text   = string.Empty;
                    this.txtTelPhone.Text  = string.Empty;
                    this.txtCellPhone.Text = string.Empty;

                    txtShippingId.Text = "";
                    this.Page.Response.Redirect("UserShippingAddresses.aspx");
                    return;
                }
                else
                {
                    this.ShowMessage("删除失败", false);
                }
            }
            if (e.CommandName == "SetDefault")
            {
                if (MemberProcessor.SetDefaultShippingAddressPC(num, HiContext.Current.User.UserId))
                {
                    this.Page.Response.Redirect("UserShippingAddresses.aspx");
                }
                else
                {
                    this.ShowMessage("设置默认失败", false);
                }
            }
            this.BindList();
        }
Exemple #22
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();
 }
Exemple #23
0
 public static bool CreateShippingAddress(ShippingAddressInfo shippingAddress)
 {
     if (null == shippingAddress)
     {
         return(false);
     }
     Globals.EntityCoding(shippingAddress, true);
     return(PersonalProvider.Instance().CreateUpdateDeleteShippingAddress(shippingAddress, DataProviderAction.Create));
 }
Exemple #24
0
 public static int AddShippingAddress(ShippingAddressInfo shippingAddress)
 {
     if (null == shippingAddress)
     {
         return(0);
     }
     Globals.EntityCoding(shippingAddress, true);
     return(PersonalProvider.Instance().AddShippingAddress(shippingAddress));
 }
Exemple #25
0
        public virtual ShippingAddressInfo CreateShippingAddress(ShippingAddressInfo shippingAddress)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("InsertShippingAddress");

            cmd.SetParameterValue <ShippingAddressInfo>(shippingAddress);
            cmd.ExecuteNonQuery();
            shippingAddress.SysNo = int.Parse(cmd.GetParameterValue("@SysNo").ToString());
            return(shippingAddress);
        }
        public object GetShippingAddressList(long shopBranchId)
        {
            if (shopBranchId == 0L)
            {
                throw new HimallException("获取门店ID失败");
            }
            this.CheckUserLogin();
            IQueryable <ShippingAddressInfo> shippingAddressByUserId = Instance <IShippingAddressService> .Create.GetUserShippingAddressByUserId(this.CurrentUser.Id);

            List <ShippingAddressInfo> list           = new List <ShippingAddressInfo>();
            ShopBranchInfo             shopBranchById = Instance <IShopBranchService> .Create.GetShopBranchById(shopBranchId);

            if (shopBranchById == null || !shopBranchById.IsStoreDelive)
            {
                throw new HimallException("门店ID错误,或不支持配送");
            }
            foreach (ShippingAddressInfo shippingAddressInfo1 in (IEnumerable <ShippingAddressInfo>)shippingAddressByUserId)
            {
                int?serveRadius = shopBranchById.ServeRadius;
                if (serveRadius.HasValue)
                {
                    string fromLatLng = string.Format("{0},{1}", (object)shippingAddressInfo1.Latitude, (object)shippingAddressInfo1.Longitude);
                    if (fromLatLng.Length > 1)
                    {
                        double distancesFromApi = Instance <IShopBranchService> .Create.GetLatLngDistancesFromAPI(fromLatLng, string.Format("{0},{1}", (object)shopBranchById.Latitude, (object)shopBranchById.Longitude));

                        double num = distancesFromApi;
                        serveRadius = shopBranchById.ServeRadius;
                        if ((num >= (double)serveRadius.GetValueOrDefault() ? 0 : (serveRadius.HasValue ? 1 : 0)) != 0 && distancesFromApi != 0.0)
                        {
                            shippingAddressInfo1.CanDelive = true;
                        }
                    }
                }
                ShippingAddressInfo shippingAddressInfo2 = new ShippingAddressInfo()
                {
                    Id             = shippingAddressInfo1.Id,
                    ShipTo         = shippingAddressInfo1.ShipTo,
                    Phone          = shippingAddressInfo1.Phone,
                    RegionFullName = shippingAddressInfo1.RegionFullName,
                    Address        = shippingAddressInfo1.Address,
                    RegionId       = shippingAddressInfo1.RegionId,
                    RegionIdPath   = shippingAddressInfo1.RegionIdPath,
                    IsDefault      = shippingAddressInfo1.IsDefault,
                    Latitude       = shippingAddressInfo1.Latitude,
                    Longitude      = shippingAddressInfo1.Longitude,
                    CanDelive      = shippingAddressInfo1.CanDelive
                };
                list.Add(shippingAddressInfo2);
            }
            return((object)this.Json(new
            {
                Success = "true",
                ShippingAddress = list
            }));
        }
Exemple #27
0
        /// <summary>
        /// 增加代理商的收货地址
        /// </summary>
        /// <param name="shippingAddress"></param>
        /// <returns></returns>
        public static int AddAgentShippingAddress(ShippingAddressInfo shippingAddress)
        {
            ShippingAddressDao dao = new ShippingAddressDao();
            int shippingId         = dao.AddShippingAddress(shippingAddress);

            if (dao.SetDefaultShippingAddress(shippingId, shippingAddress.UserId))
            {
                return(1);
            }
            return(0);
        }
Exemple #28
0
        public ActionResult EditShippingAddress(long addressId = 0L, string returnURL = "")
        {
            ShippingAddressInfo shippingAddressInfo = new ShippingAddressInfo();

            if (addressId != 0)
            {
                shippingAddressInfo = ServiceHelper.Create <IShippingAddressService>().GetUserShippingAddress(addressId);
            }
            ViewBag.addId = addressId;
            return(View(shippingAddressInfo));
        }
Exemple #29
0
        public static int AddShippingAddress(ShippingAddressInfo shippingAddress)
        {
            ShippingAddressDao dao = new ShippingAddressDao();
            int shippingId         = dao.AddShippingAddress(shippingAddress);

            if (dao.SetDefaultShippingAddress(shippingId, Globals.GetCurrentMemberUserId()))
            {
                return(1);
            }
            return(0);
        }
Exemple #30
0
        public ActionResult EditShippingAddress(long addressId = 0L, string returnURL = "")
        {
            ShippingAddressInfo userAddress = OrderApplication.GetUserAddress(addressId);

            ViewBag.addId = addressId;
            if (userAddress != null)
            {
                ViewBag.fullPath = RegionApplication.GetRegionPath(userAddress.RegionId);
                ViewBag.fullName = RegionApplication.GetFullName(userAddress.RegionId, " ");
            }
            return(base.View(userAddress));
        }