protected override object ReadRow(IRowReader reader)
        {
            UserPasswordHistory userPasswordHistory = UserPasswordHistory.New();

            // Table Fields
            userPasswordHistory.UserPasswordHistoryId = reader.GetInt32("UserPasswordHistoryId");
            userPasswordHistory.UserId   = reader.GetInt32("UserId");
            userPasswordHistory.Password = reader.GetString("Password");
            userPasswordHistory.Date     = reader.GetDateTime("Date");


            userPasswordHistory.IsDirty = false;
            userPasswordHistory.ChangedProperties.Clear();

            return(userPasswordHistory);
        }
        public virtual UserPasswordHistory Update(UserPasswordHistory userPasswordHistory)
        {
            if (!userPasswordHistory.IsDirty || userPasswordHistory.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(userPasswordHistory);
            }

            IDbCommand command = CreateCommand();

            if (userPasswordHistory.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [UserPasswordHistory] ([UserId], [Password], [Date]) VALUES (@userId, @password, @date) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [UserPasswordHistory] SET [UserId] = @userId, [Password] = @password, [Date] = @date WHERE UserPasswordHistoryId = @userPasswordHistoryId";
            }

            command.Parameters.Add(CreateParameter("@userId", userPasswordHistory.UserId));
            command.Parameters.Add(CreateParameter("@password", userPasswordHistory.Password));
            command.Parameters.Add(CreateParameter("@date", userPasswordHistory.Date));

            if (userPasswordHistory.IsNew)
            {
                userPasswordHistory.UserPasswordHistoryId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@userPasswordHistoryId", userPasswordHistory.UserPasswordHistoryId));
                ExecuteCommand(command);
            }

            userPasswordHistory.IsDirty = false;
            userPasswordHistory.ChangedProperties.Clear();

            return(userPasswordHistory);
        }
Exemplo n.º 3
0
 public static UserPasswordHistory Update(UserPasswordHistory userPasswordHistory)
 {
     return(UserPasswordHistoryMapper.Instance.Update(userPasswordHistory));
 }
Exemplo n.º 4
0
        public static UserPasswordHistory FindOne(UserPasswordHistoryFinder finder)
        {
            UserPasswordHistory UserPasswordHistory = UserPasswordHistoryMapper.Instance.FindOne(finder);

            return(UserPasswordHistory ?? Empty);
        }
Exemplo n.º 5
0
        public static UserPasswordHistory Get(Nullable <Int32> UserPasswordHistoryId)
        {
            UserPasswordHistory UserPasswordHistory = UserPasswordHistoryMapper.Instance.Get(UserPasswordHistoryId);

            return(UserPasswordHistory ?? Empty);
        }