在C#中实现3层架构(2)

public BOCustomer()

{

//An instance of the Data access layer!

cusData = new DACustomer();

}  

///

/// Property FirstName (String)

///

public String FName

{

get

{

return this.fName;

}

set

{

try

{

this.fName = value;

if (this.fName == "")

{

throw new Exception(

"Please provide first name ...");

}

}

catch(Exception e)

{

throw new Exception(e.Message.ToString());

}

}

}

///

/// Property LastName (String)

///

public String LName

{

get

{

return this.lName;

}

set

{

//could be more checkings here eg revmove ' chars

//change to proper case

//blah blah

this.lName = value;

if (this.LName == "")

{

throw new Exception("Please provide name ...");

}

}

}    

///

/// Property Customer ID (String)

///

public String cusID

{

get

{

return this.cusId;

}

set

{

this.cusId = value;

if (this.cusID == "")

{

throw new Exception("Please provide ID ...");

}

}

}

///

/// Property Address (String)

///

public String Address

{

get

{

return this.address;

}

set

{

this.address = value;

if (this.Address == "")

{

throw new Exception("Please provide address ...");

}

}

}

///

/// Property Telephone (String)

///

public String Tel

{

get

{

return this.tel;

}

set

{

this.tel = value;

if (this.Tel == "")

{

throw new Exception("Please provide Tel ...");

}

}

}


你可能感兴趣的:(C#)