示例#1
0
        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";
            }
        }
示例#2
0
        private SqlCommand CreateInsertMailMethodCommand(
            MailMethod mailMethod)
        {
            string SQL = "INSERT INTO PaycheckAddress " +
                         "VALUES (@Address, @EmpId)";
            SqlCommand command = new SqlCommand(SQL);

            command.Parameters.AddWithValue("@Address", mailMethod.Address);
            command.Parameters.AddWithValue("@EmpId", employee.Id);

            return(command);
        }