Exemplo n.º 1
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;
     }
 }