public bool Update(UsersRecord user) { _context.Attach(user); _context.Users.Add(user); _context.SaveChanges(); return(true); }
public override string EvaluateExpressions(string url, string arg, bool bEncrypt, bool includeSession) { UsersRecord rec = null; try { rec = this.GetRecord(); } catch (Exception) { // Do Nothing } if (rec == null && url.IndexOf("{") >= 0) { // Localization. throw new Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "RatTrap")); } if (includeSession) { return(EvaluateExpressions(url, arg, rec, bEncrypt)); } else { return(EvaluateExpressions(url, arg, rec, bEncrypt, includeSession)); } }
/// <inheritdoc /> protected override async Task <TUser> FindUserAsync(TKey userId, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); var user = await UsersRecord.FindByIdAsync(userId); return(user); }
public bool Insert(UsersRecord user) { bool res; _context.Users.Add(user); res = Convert.ToBoolean(_context.SaveChanges()); return(res); }
public bool Update(Users user) { UsersRecord record = new UsersRecord { Id = user.Id, Name = user.Name, Description = user.Description, CreatedBy = user.CreatedBy, UpdatedBy = user.UpdatedBy, UpdatedTime = user.UpdatedTime, CreatedTime = user.CreatedTime }; return(Repo.Update(record)); }
/// <inheritdoc /> public override async Task <TUser> FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); var user = await UsersRecord.FindByEmailAsync(normalizedEmail); return(user); }
/// <inheritdoc /> public override async Task <TUser> FindByIdAsync(string userId, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); var id = ConvertIdFromString(userId); var user = await UsersRecord.FindByIdAsync(id); return(user); }
/// <inheritdoc /> public override async Task <IList <TUser> > GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); claim.ThrowIfNull(nameof(claim)); var users = await UsersRecord.GetUsersForClaimAsync(claim); return(users.ToList()); }
//Audit Trail methods //Evaluates Initialize when->Reading record formulas specified at the data access layer protected virtual void UsersRecord_ReadRecord(Object sender, System.EventArgs e) { //Apply Initialize->Reading record formula only if validation is successful. UsersRecord UsersRec = (UsersRecord)sender; if (UsersRec != null && !UsersRec.IsReadOnly) { } }
//Evaluates Initialize when->Updating formulas specified at the data access layer protected virtual void UsersRecord_UpdatingRecord(Object sender, System.ComponentModel.CancelEventArgs e) { //Apply Initialize->Updating formula only if validation is successful. UsersRecord UsersRec = (UsersRecord)sender; Validate_Updating(); if (UsersRec != null && !UsersRec.IsReadOnly) { UsersRec.Parse(EvaluateFormula("\"1\"", this, null), UsersTable.ActiveEventId); } }
//Evaluates Initialize when->Inserting formulas specified at the data access layer protected virtual void UsersRecord_InsertingRecord(Object sender, System.ComponentModel.CancelEventArgs e) { //Apply Initialize->Inserting formula only if validation is successful. UsersRecord UsersRec = (UsersRecord)sender; Validate_Inserting(); if (UsersRec != null && !UsersRec.IsReadOnly) { UsersRec.Parse(EvaluateFormula("UserID()", this, null), UsersTable.CreatedBy); UsersRec.Parse(EvaluateFormula("Today()", this, null), UsersTable.CreatedOn); } }
/// <inheritdoc /> public override async Task <IdentityResult> DeleteAsync(TUser user, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); user.ThrowIfNull(nameof(user)); var deleted = await UsersRecord.DeleteAsync(user.Id); return(deleted ? IdentityResult.Success : IdentityResult.Failed(new IdentityError { Code = string.Empty, Description = $"User '{user.UserName}' could not be deleted." })); }
/// <inheritdoc /> public override async Task <IdentityResult> UpdateAsync(TUser user, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); user.ThrowIfNull(nameof(user)); user.ConcurrencyStamp = Guid.NewGuid().ToString(); var updated = await UsersRecord.UpdateAsync(user, UserClaims, UserRoles, UserLogins, UserTokens); return(updated ? IdentityResult.Success : IdentityResult.Failed(new IdentityError { Code = string.Empty, Description = $"User '{user.UserName}' could not be deleted." })); }
public virtual void LoadData() { // Load the data from the database into the DataSource DatabaseTheRatTrap%dbo.Users record. // It is better to make changes to functions called by LoadData such as // CreateWhereClause, rather than making changes here. // The RecordUniqueId is set the first time a record is loaded, and is // used during a PostBack to load the record. if (this.RecordUniqueId != null && this.RecordUniqueId.Length > 0) { this.DataSource = UsersTable.GetRecord(this.RecordUniqueId, true); return; } // This is the first time a record is being retrieved from the database. // So create a Where Clause based on the staic Where clause specified // on the Query wizard and the dynamic part specified by the end user // on the search and filter controls (if any). WhereClause wc = this.CreateWhereClause(); // If there is no Where clause, then simply create a new, blank record. if (wc == null || !(wc.RunQuery)) { this.DataSource = new UsersRecord(); return; } // Retrieve the record from the database. It is possible UsersRecord[] recList = UsersTable.GetRecords(wc, null, 0, 2); if (recList.Length == 0) { // There is no data for this Where clause. wc.RunQuery = false; return; } // Set DataSource based on record retrieved from the database. this.DataSource = (UsersRecord)UsersRecord.Copy(recList[0], false); }
/// <inheritdoc /> public override async Task <IList <TUser> > GetUsersInRoleAsync(string normalizedRoleName, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); if (string.IsNullOrEmpty(normalizedRoleName)) { throw new ArgumentNullException(nameof(normalizedRoleName)); } var role = await FindRoleAsync(normalizedRoleName, cancellationToken); var users = new List <TUser>(); if (role != null) { users = (await UsersRecord.GetUsersInRoleAsync(normalizedRoleName)).ToList(); } return(users); }
/// <summary> /// This is a shared function that can be used to get a UsersRecord record using a where and order by clause. /// </summary> public static UsersRecord GetRecord(BaseFilter join, string where, OrderBy orderBy) { SqlFilter whereFilter = null; if (where != null && where.Trim() != "") { whereFilter = new SqlFilter(where); } ArrayList recList = UsersTable.Instance.GetRecordList(join, whereFilter, null, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE); UsersRecord rec = null; if (recList.Count > 0) { rec = (UsersRecord)recList[0]; } return(rec); }
public bool Insert(UsersRecord user) { throw new NotImplementedException(); }
public bool Update(UsersRecord user) { throw new NotImplementedException(); }