Ejemplo n.º 1
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();
        }
        protected void dtlstRegionsSelect_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int num = Convert.ToInt32(e.CommandArgument);

            this.ViewState["shippingId"] = num;
            if (e.CommandName == "Edit")
            {
                ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(num);
                if (shippingAddress != null)
                {
                    this.hidAddressId.Value = num.ToString();
                    this.txtShipTo.Text     = shippingAddress.ShipTo;
                    this.dropRegionsSelect.SetSelectedRegionId(shippingAddress.RegionId);
                    this.txtAddress.Text       = shippingAddress.RegionLocation + shippingAddress.Address;
                    this.txtTelPhone.Text      = shippingAddress.TelPhone;
                    this.txtCellPhone.Text     = shippingAddress.CellPhone;
                    this.chkIsDefault.Checked  = shippingAddress.IsDefault;
                    this.txtBuilderNumber.Text = shippingAddress.BuildingNumber;
                    this.BindList();
                }
                else
                {
                    this.hidAddressId.Value = "0";
                }
            }
            if (e.CommandName == "Delete")
            {
                if (MemberProcessor.DelShippingAddress(num, HiContext.Current.UserId))
                {
                    this.ShowMessage("成功的删除了你要删除的记录", true, "", 1);
                    this.txtShipTo.Text        = string.Empty;
                    this.txtAddress.Text       = string.Empty;
                    this.txtTelPhone.Text      = string.Empty;
                    this.txtCellPhone.Text     = string.Empty;
                    this.txtBuilderNumber.Text = string.Empty;
                    this.BindList();
                    this.hidAddressId.Value = "0";
                }
                else
                {
                    this.ShowMessage("删除失败", false, "", 1);
                }
                num = 0;
            }
            if (e.CommandName == "SetDefault")
            {
                if (MemberProcessor.SetDefaultShippingAddress(num, HiContext.Current.UserId))
                {
                    this.ShowMessage("设置默认收货地址成功", true, "", 1);
                    this.txtShipTo.Text        = string.Empty;
                    this.txtAddress.Text       = string.Empty;
                    this.txtTelPhone.Text      = string.Empty;
                    this.txtCellPhone.Text     = string.Empty;
                    this.txtBuilderNumber.Text = string.Empty;
                    this.hidAddressId.Value    = "0";
                    this.BindList();
                }
                else
                {
                    this.ShowMessage("删除失败", false, "", 1);
                }
                num = 0;
            }
        }