Beispiel #1
0
 public bool Update()
 {
     int cid = _address.Consignee_Id;
     Tnet_Consignee daConsignee = new Tnet_Consignee();
     if (!daConsignee.SelectByPk(cid))
     {
         Alert("指定修改的收货人信息不存在");
         return false;
     }
     BeginTransaction();
     ConsigneeCreationProvider creationProvider = new ConsigneeCreationProvider(_address);
     creationProvider.ReferenceTransactionFrom(Transaction);
     if (!creationProvider.Create())
     {
         Rollback();
         Alert("更新收货地址失败,请重试!");
         return false;
     }
     var oldAddress = _address;
     this._address = creationProvider.ShippingAddress;//new shipping address
     ConsigneeDeleteProvider deleteProvider = new ConsigneeDeleteProvider(oldAddress.Address_Id, oldAddress.User_Id);//delete old shipping address
     deleteProvider.ReferenceTransactionFrom(Transaction);
     if (!deleteProvider.Delete())
     {
         Rollback();
         Alert("更新收货地址失败,请重试!");
         return false;
     }
     Commit();
     return true;
 }
Beispiel #2
0
        public bool Delete(int address_id, int userId)
        {
            ConsigneeDeleteProvider deleteProvider = new ConsigneeDeleteProvider(address_id, userId);

            return(deleteProvider.Delete());
        }