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

[摘要]publicBOCustomer(){//AninstanceoftheDataaccesslayer!cusData=newDACustomer();}///<SUMMARY>///PropertyFirstName(String)///</SUMMARY>publicSt

public BOCustomer()

{

//An instance of the Data access layer!

cusData = new DACustomer();

}  

/// <SUMMARY>

/// Property FirstName (String)

/// </SUMMARY>

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());

}

}

}

/// <SUMMARY>

/// Property LastName (String)

/// </SUMMARY>

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 ...");

}

}

}    

/// <SUMMARY>

/// Property Customer ID (String)

/// </SUMMARY>

public String cusID

{

get

{

return this.cusId;

}

set

{

this.cusId = value;

if (this.cusID == "")

{

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

}

}

}

/// <SUMMARY>

/// Property Address (String)

/// </SUMMARY>

public String Address

{

get

{

return this.address;

}

set

{

this.address = value;

if (this.Address == "")

{

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

}

}

}

/// <SUMMARY>

/// Property Telephone (String)

/// </SUMMARY>

public String Tel

{

get

{

return this.tel;

}

set

{

this.tel = value;

if (this.Tel == "")

{

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

}

}

}




免责声明:

本站系本网编辑转载,会尽可能注明出处,但不排除无法注明来源的情况,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如涉及作品内容、版权和其它问题,请在30日内与本网联系, 来信: liujun@soft6.com 我们将在收到邮件后第一时间删除内容!

[声明]本站文章版权归原作者所有,内容为作者个人观点,不代表本网站的观点和对其真实性负责,本站拥有对此声明的最终解释权。