Esempio n. 1
0
 public virtual double Withdraw(int p_widrawalAmount)
 {
     //trying to connect to db
     //throw new System.Data.SqlClient.SqlException("Server not available")
     if (p_widrawalAmount == null)
     {
         throw new NullReferenceException();
     }
     if (p_widrawalAmount < 0)
     {
         throw new Exception("Negative widrawl of money");
     }
     if (AccountNumber.StartsWith("CUR"))
     {
         if (p_widrawalAmount > AccountBalance + 20000)
         {
             throw new Exception("Insufficient Balance");
         }
     }
     else if (p_widrawalAmount > AccountBalance)
     {
         throw new Exception("Insufficient Balance");
     }
     AccountBalance -= p_widrawalAmount;
     return(AccountBalance);
 }