/// <summary>Extracts the Password reset ticket instance from the current record of the specified data reader.</summary> public override IEntity Parse(IDataReader reader) { var result = new Domain.PasswordResetTicket(); FillData(reader, result); EntityManager.SetSaved(result, reader.GetGuid(0)); return(result); }
/// <summary>Updates the specified existing Password reset ticket instance in the database.</summary> void Update(Domain.PasswordResetTicket item) { if (ExecuteScalar(UPDATE_COMMAND, CommandType.Text, CreateParameters(item)).ToStringOrEmpty().IsEmpty()) { Cache.Current.Remove(item); throw new ConcurrencyException($"Failed to update the 'PasswordResetTickets' table. There is no row with the ID of {item.ID}."); } }
/// <summary>Loads the data from the specified data reader on the specified Password reset ticket instance.</summary> internal static void FillData(IDataReader reader, Domain.PasswordResetTicket entity) { var values = new object[reader.FieldCount]; reader.GetValues(values); entity.UserId = (Guid)values[1]; entity.DateCreated = (DateTime)values[2]; entity.IsUsed = (bool)values[3]; }
/// <summary>Creates parameters for Inserting or Updating Password reset ticket records</summary> IDataParameter[] CreateParameters(Domain.PasswordResetTicket item) { var result = new List <IDataParameter>(); result.Add(CreateParameter("OriginalId", item.OriginalId)); result.Add(CreateParameter("Id", item.GetId())); result.Add(CreateParameter("User", item.UserId)); result.Add(CreateParameter("DateCreated", item.DateCreated)); result.Add(CreateParameter("IsUsed", item.IsUsed)); return(result.ToArray()); }
/// <summary>Inserts the specified new Password reset ticket instance into the database.</summary> void Insert(Domain.PasswordResetTicket item) { ExecuteScalar(INSERT_COMMAND, CommandType.Text, CreateParameters(item)); }