private void PrepareToSavePaymentMethod() { PaymentMethod method = employee.Method; if (method is HoldMethod) { methodCode = "hold"; } else if (method is DirectDepositMethod) { methodCode = "directdeposit"; DirectDepositMethod ddMethod = method as DirectDepositMethod; insertPaymentMethodCommand = CreateInsertDirectDepositCommand(ddMethod); } else if (method is MailMethod) { methodCode = "mail"; MailMethod mailMethod = method as MailMethod; insertPaymentMethodCommand = CreateInsertMailMethodCommand(mailMethod); } else { methodCode = "unknown"; } }
private SqlCommand CreateInsertDirectDepositCommand( DirectDepositMethod ddMethod) { string SQL = "INSERT INTO DirectDepositAccount " + "VALUES (@Bank, @Account, @EmpId)"; SqlCommand command = new SqlCommand(SQL); command.Parameters.AddWithValue("@Bank", ddMethod.Bank); command.Parameters.AddWithValue("@Account", ddMethod.AccountNumber); command.Parameters.AddWithValue("@EmpId", employee.Id); return(command); }