// 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); }
// 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; }