Esempio n. 1
0
 public OperationResult<ICustomerDTO> GetCustomerByEmailAddress(string emailAddress)
 {
     OperationResult<ICustomerDTO> result;
     ICustomerDTO customer = new CustomerDTO();
     try
     {
         EntityConverter.FillDTOFromEntity(customerDAC.GetCustomerByEmailAddress(emailAddress), customer);
         if (customer == null)
         {
             result = OperationResult<ICustomerDTO>.CreateFailureResult("The customer object being retrieved is null!");
         }
         else
         {
             result = OperationResult<ICustomerDTO>.CreateSuccessResult(customer, "Customer object fetched successfully!");
         }
     }
     catch (DataAccessException dacEx)
     {
         this.ExceptionManager.HandleException(dacEx);
         result = OperationResult<ICustomerDTO>.CreateErrorResult(dacEx.Message, dacEx.StackTrace);
     }
     catch (Exception ex)
     {
         throw new BusinessDomainException("An error occured in business layer while fetching customer through his email address", ex.InnerException);
     }
     return result;
 }
Esempio n. 2
0
 static void Main(string[] args)
 {
     CustomerDAC customerDAC = new CustomerDAC();
     CustomerDTO customerDTO = new CustomerDTO();
     EntityConverter.FillDTOFromEntity(customerDAC.GetCustomerByEmailAddress("*****@*****.**"), customerDTO);
     Customer customer = new Customer();
     EntityConverter.FillEntityFromDTO(customerDTO, customer);
 }