Exemple #1
0
        public override string ToString()
        {
            string m = String.Format("[OverdraftAccount:accountNumber={0},accountHolder={1},balance={2}]",
                                     AccountNumber, AccountHolder.ToString(), Balance);

            return(m);
        }
Exemple #2
0
        public static bool SaveToFile(AccountHolder ah)
        {
            SaveToDB(ah);
            String timeStamp = DateTime.Now.Millisecond.ToString();

            File.WriteAllText(@"C:\Sandbox\AccountHolder" + timeStamp + ".dat", ah.ToString());
            return(true);
        }
Exemple #3
0
        public static void SaveToDB(AccountHolder ah)
        {
            SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder
            {
                ConnectionString = @"Integrated Security=SSPI;
                                    Persist Security Info=False;Initial Catalog=AcmeBanking;
                                    Data Source=STUDENT03\SQLEXPRESS"
            };

            using (SqlConnection conn = new SqlConnection(sb.ConnectionString))
            {
                String cmdText = $@"insert into AcmeBanking.dbo.TransactionLog(name,details,TransactionDate)
                                    values('New Account', '{ah.ToString()}', getdate()); ";
                conn.Open();
                SqlCommand cmd = new SqlCommand(cmdText, conn);
                cmd.ExecuteNonQuery();
                conn.Close();
            }
        }
Exemple #4
0
 public override string ToString()
 {
     return(accountNumber + " " + AccountHolder.ToString());
 }