public MoneyTransferObject() { connection = getCSConnection(); connection.Open(); command = new EmpressCommand(); command.Connection = connection; initializeView(); initializeMake(); }
private void initializeView() { viewCommand = new EmpressCommand(); viewCommand.Connection = connection; viewCommand.CommandText = "SELECT Trans_No, Source_Acct, C2.Acct_Name AS Source_Name, Dist_Acct, C4.Acct_Name AS Dist_Name, Amount, Date FROM transactions" + " INNER JOIN Customer_Accounts AS C2 ON Source_Acct = C2.Acct_No" + " INNER JOIN Customer_Accounts AS C4 ON Dist_Acct = C4.Acct_No" + " WHERE Source_Acct = @viewAccount1 OR Dist_Acct = @viewAccount2 " + " ORDER BY Date DESC"; EmpressParameter p1 = new EmpressParameter("@viewAccount1"); EmpressParameter p2 = new EmpressParameter("@viewAccount2"); viewCommand.Parameters.Add(p1); viewCommand.Parameters.Add(p2); viewCommand.Prepare(); }
private void initializeMake() { //Prepare Source Command sourceUpdate = new EmpressCommand(); sourceUpdate.Connection = connection; sourceUpdate.CommandText = "UPDATE Customer_Accounts SET Balance TO Balance - @Amount WHERE Acct_No = @Source_Acct_No"; //Prepare Dist Command distUpdate = new EmpressCommand(); distUpdate.Connection = connection; //Prepare IdUpdate Command transIdUpdate = new EmpressCommand(); transIdUpdate.Connection = connection; transIdUpdate.CommandText = "SELECT COUNT(*) FROM transactions"; //transIdUpdate.Prepare(); //Prepare Insert Commmand insertCommand = new EmpressCommand(); insertCommand.Connection = connection; }