public AddressDTO(byte id, string streetName, string streetNo, string country, CityDTO city) { this.id = id; this.streetName = streetName; this.streetNo = streetNo; this.country = country; this.city = city; }
public AddressDTO FindAddress(string email) { AddressDTO address = new AddressDTO(); AccountDTO customer = new AccountDTO(); try { customer = AB.FindBy(email); if (customer != null) { CityDTO city = new CityDTO(); address = DB.FindBy(customer.GetAddress().GetID()); if (address != null) { city = CB.FindBy(address.GetCity().GetId()); address.SetCity(city); Debug.Print("AddressBL: /FindAddress/ " + address.GetID()); Debug.Print("AddressBL: /StreetName/ " + address.GetStreetName()); Debug.Print("AddressBL: /StreetNo/ " + address.GetStreetNo()); // Debug.Print("AddressBL: /CityName/ " + address.GetCity().GetCity()); return(address); } else { throw new EmptyRowException("No result found."); } } else { throw new EmptyRowException("No result found."); } } catch (Exception e) { e.GetBaseException(); } return(null); }
/// <summary> /// Find an address of a customer. /// </summary> /// <param name="accountID"></param> /// <returns></returns> public AddressDTO FindAddress(int accountID) { AccountDTO customer = new AccountDTO(); AddressDTO address = new AddressDTO(); customer = AB.FindBy(accountID); if (customer != null) { CityDTO city = new CityDTO(); address = DB.FindBy(customer.GetAddress().GetID()); city = CB.FindBy(address.GetCity().GetId()); address.SetCity(city); Debug.Print("AddressBL: /FindAddress/ " + address.GetID()); Debug.Print("AddressBL: /StreetName/ " + address.GetStreetName()); Debug.Print("AddressBL: /StreetNo/ " + address.GetStreetNo()); Debug.Print("AddressBL: /CityName/ " + address.GetCity().GetCity()); } else { throw new EmptyRowException("No result found."); } return(address); }
public void SetCity(CityDTO city) { this.city = city; }