Beispiel #1
0
        public virtual void Add(IUserAccount user)
        {
            DbCommand command = _dbCommandFactory.CreateCommand("AdminAccount_Add",
                                                                _dbCommandFactory.CreateParameter("ID", user.ID),
                                                                _dbCommandFactory.CreateParameter("AccountCreationDateTime", user.AccountCreationDateTime),
                                                                _dbCommandFactory.CreateParameter("AccountStatus", user.AccountStatus),
                                                                _dbCommandFactory.CreateParameter("EmailAddress", user.EmailAddress),
                                                                _dbCommandFactory.CreateParameter("FirstName", user.FirstName),
                                                                _dbCommandFactory.CreateParameter("LastName", user.LastName),
                                                                _dbCommandFactory.CreateParameter("LastWrongPasswordAttemptDateTime", user.LastWrongPasswordAttemptDateTime),
                                                                _dbCommandFactory.CreateParameter("MobileNumber", user.MobileNumber),
                                                                _dbCommandFactory.CreateParameter("Password", user.EncryptedPassword),
                                                                _dbCommandFactory.CreateParameter("WrongPasswordAttempt", user.WrongPasswordAttempt)
                                                                );

            _dbCommandExecutionService.ExecuteCommand(command);
        }
        public virtual Dictionary <string, object> ExecuteStoredProcedure(string storedProcedureName, Dictionary <string, object> parameters,
                                                                          Dictionary <string, object> outParameters)
        {
            DbCommand command = dbCommandFactory.CreateCommand(storedProcedureName);

            if (parameters != null)
            {
                foreach (var item in parameters)
                {
                    command.Parameters.Add(dbCommandFactory.CreateParameter(item.Key, item.Value));
                }
            }

            if (outParameters != null)
            {
                foreach (var item in outParameters)
                {
                    command.Parameters.Add(dbCommandFactory.CreateOutputParameter(item.Key, item.Value.GetType()));
                }
            }

            int effect = dbCommandExecutionService.ExecuteCommand(command);

            Dictionary <string, object> result = null;

            if (outParameters != null)
            {
                result = new Dictionary <string, object>();
                foreach (var item in outParameters)
                {
                    result.Add(item.Key, command.Parameters[item.Key].Value);
                }
            }

            return(result);
        }