朋友ANT给了个题目做
要求:(环境 VS2003+MSSQLServer2000)
编写一个银行客户类,要求有基本的构造函数,同时包含姓名,帐号,存款余额等属性,并且要求实现构造函数的重载。对于该银行客户类,实现属性存款余额的读写操作,实现包含异常处理的验证文本框输入是否有效整型数的功能,创建一个指向SQL SERVER的连接,并将数据库中的数据在DataGrid控件中显示.
<script type="text/javascript"> // </script>
/**//// <summary>
/// 银行客户类
/// </summary>
public class BankCustomer : Customer, IBankCustomer
{
public BankCustomer() : base()
{ }
public BankCustomer(int customerId, string customerName, Account accountInfo)
: base()
{
this._customerId = customerId;
this._customerName = customerName;
this._accountInfo = accountInfo;
}
/**//// <summary>
/// 读取客户及帐户相关信息
/// </summary>
public override void Load()
{
throw new Exception("The method or operation is not implemented.");
}
/**//// <summary>
/// 新开户
/// </summary>
public override bool Insert()
{
throw new Exception("The method or operation is not implemented.");
}
/**//// <summary>
/// 更新客户信息
/// </summary>
public override bool Update()
{
throw new Exception("The method or operation is not implemented.");
}
/**//// <summary>
/// 删除
/// </summary>
public override bool Delete(string customerId)
{
throw new Exception("The method or operation is not implemented.");
}
IBankCustomer 成员#region IBankCustomer 成员
/**//// <summary>
/// 存款
/// </summary>
bool IBankCustomer.Add(float money)
{
throw new Exception("The method or operation is not implemented.");
}
/**//// <summary>
/// 取款
/// </summary>
bool IBankCustomer.Take(float money)
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
}
/**//// <summary>
/// 银行帐户类
/// </summary>
public class Account
{
private string _accountNo = string.Empty;
private float _balance = 0;
public Account()
{
//在此处添加逻辑
}
public Account(string accountNo, float balance)
{
this._accountNo = accountNo;
this._balance = balance;
}
/**//// <summary>
/// 帐号
/// </summary>
public string AccountNo
{
get
{ return this._accountNo; }
set
{ this._accountNo = value; }
}
/**//// <summary>
/// 余额
/// </summary>
public float Balance
{
get
{ return this._balance; }
set
{ this._balance = value; }
}
}
/**//// <summary>
/// 客户类
/// </summary>
public abstract class Customer
{
protected string _customerId = string.Empty;
protected string _customerName = string.Empty;
protected Account _accountInfo = null;
public Customer()
{
//在此处添加代码
}
public string CustomerId
{
get
{ return this._customerId; }
set
{ this._customerId = value; }
}
public string CustomerName
{
get
{ return this._customerName; }
set
{ this._customerName = value; }
}
public Account AccountInfo
{
get
{ return this._accountInfo; }
set
{ this._accountInfo = value; }
}
public abstract bool Insert();
public abstract bool Update();
public abstract bool Delete(string customerId);
public abstract void Load();
}
public interface IBankCustomer
{
bool Add(float money);
bool Take(float money);
}