// Get all transactions for a single account public TransactionDataSet GetTransactionHistory(int accountID, DateTime startDate, DateTime endDate) { // To allow server to work until client header authentication/encryption added if (authInfo == null) { authInfo = tempAuthInfo; } System.Data.SqlClient.SqlDataAdapter adapter; System.Data.SqlClient.SqlCommand cmd; System.Data.SqlClient.SqlConnection conn; string connString = (string)ConfigurationSettings.AppSettings["connectStringWoodgrove"]; adapter = new System.Data.SqlClient.SqlDataAdapter(); cmd = new System.Data.SqlClient.SqlCommand(); conn = new System.Data.SqlClient.SqlConnection(); // // adapter // adapter.SelectCommand = cmd; adapter.TableMappings.AddRange( new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "_GetTransactionLog", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("TransactionID", "TransactionID"), new System.Data.Common.DataColumnMapping("TransactionDate", "TransactionDate"), new System.Data.Common.DataColumnMapping("AccountID", "AccountID"), new System.Data.Common.DataColumnMapping("Amount", "Amount"), new System.Data.Common.DataColumnMapping("Description", "Description"), new System.Data.Common.DataColumnMapping("Type", "Type") }) }); // // cmd // cmd.CommandText = "_GetTransactionLog"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userID", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Username)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Password)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@acctID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, accountID)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@startDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, startDate)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@endDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, endDate)); // // conn // conn.ConnectionString = connString; // Open connection, fill dataset, close connection conn.Open(); TransactionDataSet ds = new TransactionDataSet(); adapter.Fill(ds); conn.Close(); return(ds); }
public OnlineBank() { //CODEGEN: This call is required by the ASP.NET Web Services Designer InitializeComponent(); // Intialize tempAuthInfo. Methods requiring authentication will // use as a temporary mechanism until header authentication/encryption added tempAuthInfo = new WoodgroveAuthInfo(); tempAuthInfo.Username = "******"; tempAuthInfo.Password = "******"; }
public OnlineBank() { //CODEGEN: This call is required by the ASP.NET Web Services Designer InitializeComponent(); // Intialize tempAuthInfo. Methods requiring authentication will // use as a temporary mechanism until header authentication/encryption added tempAuthInfo = new WoodgroveAuthInfo(); tempAuthInfo.Username = "******"; tempAuthInfo.Password = "******"; }
// Get all accounts for a single customer public Acct[] GetAllAccounts() { // To allow server to work until client header authentication/encryption added if (authInfo == null) { authInfo = tempAuthInfo; } System.Data.SqlClient.SqlDataAdapter adapter; System.Data.SqlClient.SqlCommand cmd; System.Data.SqlClient.SqlConnection conn; string connString = (string)ConfigurationSettings.AppSettings["connectStringWoodgrove"]; conn = new System.Data.SqlClient.SqlConnection(); adapter = new System.Data.SqlClient.SqlDataAdapter(); cmd = new System.Data.SqlClient.SqlCommand(); // // conn // conn.ConnectionString = connString; // // adapter // adapter.SelectCommand = cmd; adapter.TableMappings.AddRange( new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping( "Table", "_GetAccount", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("AccountID", "AccountID"), new System.Data.Common.DataColumnMapping("CustomerID", "CustomerID"), new System.Data.Common.DataColumnMapping("Description", "Description"), new System.Data.Common.DataColumnMapping("Balance", "Balance"), new System.Data.Common.DataColumnMapping("LastTransactionDate", "LastTransactionDate"), new System.Data.Common.DataColumnMapping("Type", "Type"), new System.Data.Common.DataColumnMapping("InterestRate", "InterestRate"), new System.Data.Common.DataColumnMapping("MinimumBalance", "MinimumBalance") }) } ); // // cmd // cmd.CommandText = "_GetAllAccounts"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userID", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Username)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Password)); // Open connection, fill dataset, close connection conn.Open(); AccountDataSet ds = new AccountDataSet(); int nRecords = adapter.Fill(ds); conn.Close(); // Check that records exists if (nRecords == 0) { return(null); } // Allocate one per account Acct[] a = new Acct[ds._GetAccount.Count]; for (int i = 0; i < ds._GetAccount.Count; i++) { // Set account information to return if (ds._GetAccount[i].Type == "SV") { SavingsAcct sa = new SavingsAcct(); sa.InterestRate = ds._GetAccount[i].InterestRate; a[i] = sa; } else if (ds._GetAccount[i].Type == "CK") { CheckingAcct ca = new CheckingAcct(); ca.MinimumBalance = ds._GetAccount[i].MinimumBalance; a[i] = ca; } a[i].AccountID = ds._GetAccount[i].AccountID; a[i].Description = ds._GetAccount[i].Description; a[i].Type = ds._GetAccount[i].Type; a[i].Balance = ds._GetAccount[i].Balance; a[i].lastTransaction = (ds._GetAccount[i].IsLastTransactionDateNull() ? new DateTime(0) : ds._GetAccount[i].LastTransactionDate); } return(a); }
// Check that there is amount can be authorized, create a token // return token and routing info public EFTBindingInfo AuthorizeFundsTransfer(int acctID, decimal amount) { // To allow server to work until client header authentication/encryption added if (authInfo == null) { authInfo = tempAuthInfo; } System.Data.SqlClient.SqlDataAdapter adapter; System.Data.SqlClient.SqlCommand cmd; System.Data.SqlClient.SqlConnection conn; string connString = (string)ConfigurationSettings.AppSettings["connectStringWoodgrove"]; string transID; conn = new System.Data.SqlClient.SqlConnection(); adapter = new System.Data.SqlClient.SqlDataAdapter(); cmd = new System.Data.SqlClient.SqlCommand(); // // cmd // // _EFTAuthorize(@userID AS nvarchar(50), @password AS nvarchar(50), @acctID as int, @amt as money, @token as nvarchar(50) output) cmd.CommandText = "_EFTAuthorize"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userID", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Username)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Password)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@acctID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, acctID)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@amt", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, amount)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@EFTTransactionID", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Output, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); // // conn // conn.ConnectionString = connString; try { // Open connection, execute, close connection conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); transID = cmd.Parameters["@EFTTransactionID"].Value.ToString(); } catch (SqlException se) { Trace.WriteLine(se.Message); throw new SoapException(se.Message, null); } // Create and set binding info EFTBindingInfo info = new EFTBindingInfo(); // Calculate expire date and format token DateTime expires = DateTime.Now.AddMinutes(5); info.token = string.Format("<eft><transactionID>{0}</transactionID><acct>{1}</acct><amt>{2}</amt><expires>{3}</expires></eft>", transID, acctID, amount, expires); info.endPoint = string.Format("http://{0}/Woodgrove/Bank.asmx", Environment.MachineName); Context.Trace.Write(string.Format("Endpoint: {0} AuthorizeFundsTransfer Acct:{1} Amt:{2}", info.endPoint, acctID, amount)); return(info); }
// Get all accounts for a single customer public Acct[] GetAllAccounts() { // To allow server to work until client header authentication/encryption added if (authInfo == null) authInfo = tempAuthInfo; System.Data.SqlClient.SqlDataAdapter adapter; System.Data.SqlClient.SqlCommand cmd; System.Data.SqlClient.SqlConnection conn; string connString = (string)ConfigurationSettings.AppSettings["connectStringWoodgrove"]; conn = new System.Data.SqlClient.SqlConnection(); adapter = new System.Data.SqlClient.SqlDataAdapter(); cmd = new System.Data.SqlClient.SqlCommand(); // // conn // conn.ConnectionString = connString; // // adapter // adapter.SelectCommand = cmd; adapter.TableMappings.AddRange( new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping( "Table", "_GetAccount", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("AccountID", "AccountID"), new System.Data.Common.DataColumnMapping("CustomerID", "CustomerID"), new System.Data.Common.DataColumnMapping("Description", "Description"), new System.Data.Common.DataColumnMapping("Balance", "Balance"), new System.Data.Common.DataColumnMapping("LastTransactionDate", "LastTransactionDate"), new System.Data.Common.DataColumnMapping("Type", "Type"), new System.Data.Common.DataColumnMapping("InterestRate", "InterestRate"), new System.Data.Common.DataColumnMapping("MinimumBalance", "MinimumBalance") }) } ); // // cmd // cmd.CommandText = "_GetAllAccounts"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userID", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Username)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Password)); // Open connection, fill dataset, close connection conn.Open(); AccountDataSet ds = new AccountDataSet(); int nRecords = adapter.Fill(ds); conn.Close(); // Check that records exists if (nRecords == 0) return null; // Allocate one per account Acct[] a = new Acct[ds._GetAccount.Count]; for (int i = 0; i < ds._GetAccount.Count; i++) { // Set account information to return if (ds._GetAccount[i].Type == "SV") { SavingsAcct sa = new SavingsAcct(); sa.InterestRate = ds._GetAccount[i].InterestRate; a[i] = sa; } else if (ds._GetAccount[i].Type == "CK") { CheckingAcct ca = new CheckingAcct(); ca.MinimumBalance = ds._GetAccount[i].MinimumBalance; a[i] = ca; } a[i].AccountID = ds._GetAccount[i].AccountID; a[i].Description = ds._GetAccount[i].Description; a[i].Type = ds._GetAccount[i].Type; a[i].Balance = ds._GetAccount[i].Balance; a[i].lastTransaction = (ds._GetAccount[i].IsLastTransactionDateNull() ? new DateTime(0) : ds._GetAccount[i].LastTransactionDate); } return a; }
// Check that there is amount can be authorized, create a token // return token and routing info public EFTBindingInfo AuthorizeFundsTransfer(int acctID, decimal amount) { // To allow server to work until client header authentication/encryption added if (authInfo == null) authInfo = tempAuthInfo; System.Data.SqlClient.SqlDataAdapter adapter; System.Data.SqlClient.SqlCommand cmd; System.Data.SqlClient.SqlConnection conn; string connString = (string)ConfigurationSettings.AppSettings["connectStringWoodgrove"]; string transID; conn = new System.Data.SqlClient.SqlConnection(); adapter = new System.Data.SqlClient.SqlDataAdapter(); cmd = new System.Data.SqlClient.SqlCommand(); // // cmd // // _EFTAuthorize(@userID AS nvarchar(50), @password AS nvarchar(50), @acctID as int, @amt as money, @token as nvarchar(50) output) cmd.CommandText = "_EFTAuthorize"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userID", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Username)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Password)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@acctID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, acctID)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@amt", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, amount)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@EFTTransactionID", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Output, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); // // conn // conn.ConnectionString = connString; try { // Open connection, execute, close connection conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); transID = cmd.Parameters["@EFTTransactionID"].Value.ToString(); } catch (SqlException se) { Trace.WriteLine(se.Message); throw new SoapException(se.Message, null); } // Create and set binding info EFTBindingInfo info = new EFTBindingInfo(); // Calculate expire date and format token DateTime expires = DateTime.Now.AddMinutes(5); info.token = string.Format("<eft><transactionID>{0}</transactionID><acct>{1}</acct><amt>{2}</amt><expires>{3}</expires></eft>", transID, acctID, amount, expires); info.endPoint = string.Format("http://{0}/Woodgrove/Bank.asmx",Environment.MachineName); Context.Trace.Write(string.Format("Endpoint: {0} AuthorizeFundsTransfer Acct:{1} Amt:{2}", info.endPoint,acctID,amount)); return info; }
// Get all transactions for a single account public TransactionDataSet GetTransactionHistory(int accountID, DateTime startDate, DateTime endDate) { // To allow server to work until client header authentication/encryption added if (authInfo == null) authInfo = tempAuthInfo; System.Data.SqlClient.SqlDataAdapter adapter; System.Data.SqlClient.SqlCommand cmd; System.Data.SqlClient.SqlConnection conn; string connString = (string)ConfigurationSettings.AppSettings["connectStringWoodgrove"]; adapter = new System.Data.SqlClient.SqlDataAdapter(); cmd = new System.Data.SqlClient.SqlCommand(); conn = new System.Data.SqlClient.SqlConnection(); // // adapter // adapter.SelectCommand = cmd; adapter.TableMappings.AddRange( new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "_GetTransactionLog", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("TransactionID", "TransactionID"), new System.Data.Common.DataColumnMapping("TransactionDate", "TransactionDate"), new System.Data.Common.DataColumnMapping("AccountID", "AccountID"), new System.Data.Common.DataColumnMapping("Amount", "Amount"), new System.Data.Common.DataColumnMapping("Description", "Description"), new System.Data.Common.DataColumnMapping("Type", "Type") }) }); // // cmd // cmd.CommandText = "_GetTransactionLog"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userID", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Username)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Password)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@acctID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, accountID)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@startDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, startDate)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@endDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, endDate)); // // conn // conn.ConnectionString = connString; // Open connection, fill dataset, close connection conn.Open(); TransactionDataSet ds = new TransactionDataSet(); adapter.Fill(ds); conn.Close(); return ds; }