Esempio n. 1
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);
 }
Esempio n. 2
0
 public EntityBase PopulateEntity(SqlDataReader reader)
 {
     Customer customer = new Customer();
     if (!reader.IsDBNull(ord_CustomerID)) customer.CustomerID = reader.GetInt32(ord_CustomerID);
     if (!reader.IsDBNull(ord_FirstName)) customer.FirstName = reader.GetString(ord_FirstName);
     if (!reader.IsDBNull(ord_LastName)) customer.LastName = reader.GetString(ord_LastName);
     if (!reader.IsDBNull(ord_Age)) customer.Age = reader.GetInt32(ord_Age);
     if (!reader.IsDBNull(ord_EmailAddress)) customer.EmailAddress = reader.GetString(ord_EmailAddress);
     return customer;
 }
Esempio n. 3
0
 public Customer GetCustomerByEmailAddress(string emailAddress)
 {
     Customer customer = new Customer();
     try
     {
         SqlCommand command = GetDbSprocCommand(StoredProcedures.GETCUSTOMER_BY_EMAILADDRESS);
         command.Parameters.Add(CreateParameter("@EmailAddress", emailAddress));
         customer = GetSingleEntity<Customer>(ref command);
     }
     catch (Exception ex)
     {
         throw new DataAccessException("An exception occurred while fetching customer using their Email address", ex);
     }
     return customer;
 }