|
namespace BLL {
public class Client : PersistentObject {
private string _firstName = null;
private string _lastName = null;
private string _middleName = null;
private long _addressUID = long.MinValue;
private Address _addressObject;
public string FirstName {
get { return _firstName; }
set { _firstName = value; }
}
public string LastName {
get { return _lastName; }
set { _lastName = value; }
}
public string MiddleName {
get { return _middleName; }
set { _middleName = value; }
}
public long AddressUID {
get { return _addressUID; }
set { _addressUID = value; }
}
/// <summary>
/// On-demand property that returns this Client's Address based on the
/// current value of AddressUID
/// </summary>
public Address Address {
get {
if (AddressUID == long.MinValue) {
_addressObject = null;
}
else if (_addressObject == null || AddressUID != _addressObject.UID) {
_addressObject = new Address();
_addressObject.Fill(AddressUID);
}
return _addressObject;
}
}
public override void Save() {
// Call DAL to save fields
// ...
}
public override void Fill(long uid) {
// Call DAL to fill fields
// ...
}
public override void Delete() {
// Call DAL to delete object
// ...
}
/// <summary>
/// Utility function that returns the Client with the given UID
/// </summary>
public static Client Fetch(long clientUID) {
return PersistentObject.Fetch<Client>(clientUID);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Brett Daniel is a graduate computer science student at the University of Illinois Urbana-Champaign. His work focuses on software engineering, application architecture, software testing, and programming languages.