예제 #1
0
 public AddPropertyPictureResult AddPropertyPicture(PartnerDTO partner, Guid propertyId, PropertyPictureDTO picture)
 {
     Connector.IsTransaction = true;
     try
     {
         PropertyBLL propertyBLL = new PropertyBLL(Connector);
         PropertyDTO property    = propertyBLL.ReadById(propertyId);
         if (property.Partner.Id == partner.Id)
         {
             PropertyPictureBLL pictureBLL = new PropertyPictureBLL(Connector);
             picture.Property = property;
             PropertyPictureBLL.CreateResult result = pictureBLL.Create(picture);
             if (result == PropertyPictureBLL.CreateResult.OK)
             {
                 Connector.CommitTransaction();
             }
             else
             {
                 Connector.RollbackTransaction();
             }
             return((AddPropertyPictureResult)(byte)result);
         }
         else
         {
             return(AddPropertyPictureResult.NotFound);
         }
     }
     catch (Exception exception)
     {
         Connector.RollbackTransaction();
         throw exception;
     }
 }
예제 #2
0
 public AddPropertyFeatureDetailResult AddPropertyFeatureDetail(PartnerDTO partner, Guid propertyId, PropertyFeatureDetailDTO featureDetail)
 {
     Connector.IsTransaction = true;
     try
     {
         PropertyBLL propertyBLL = new PropertyBLL(Connector);
         PropertyDTO property    = propertyBLL.ReadById(propertyId);
         if (property.Partner.Id == partner.Id)
         {
             PropertyFeatureDetailBLL propertyFeatureDetailBLL = new PropertyFeatureDetailBLL(Connector);
             featureDetail.Property = property;
             PropertyFeatureDetailBLL.CreateResult result = propertyFeatureDetailBLL.Create(featureDetail);
             if (result == PropertyFeatureDetailBLL.CreateResult.OK)
             {
                 Connector.CommitTransaction();
                 return(AddPropertyFeatureDetailResult.OK);
             }
             else
             {
                 Connector.RollbackTransaction();
                 if (result == PropertyFeatureDetailBLL.CreateResult.FeatureAlreadyAdded)
                 {
                     return(AddPropertyFeatureDetailResult.FeatureAlreadyAdded);
                 }
                 else
                 {
                     return(AddPropertyFeatureDetailResult.NotFound);
                 }
             }
         }
         else
         {
             return(AddPropertyFeatureDetailResult.NotFound);
         }
     }
     catch (Exception exception)
     {
         Connector.RollbackTransaction();
         throw exception;
     }
 }