public static ModelCodeFluent.Identity.RoleCollection PageLoadRolesUsersByUser(int pageIndex, int pageSize, System.Guid userId) { ModelCodeFluent.Identity.User user = ModelCodeFluent.Identity.User.Load(userId); if ((user == null)) { return(new ModelCodeFluent.Identity.RoleCollection()); } return(ModelCodeFluent.Identity.RoleCollection.PageLoadRolesUsersByUser(pageIndex, pageSize, null, user)); }
private void LoadRolesUsersByUser(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, ModelCodeFluent.Identity.User user) { if ((reader == null)) { throw new System.ArgumentNullException("reader"); } if ((pageIndex < 0)) { pageIndex = 0; } if ((pageSize < 0)) { if ((pageOptions != null)) { pageSize = pageOptions.DefaultPageSize; } else { pageSize = int.MaxValue; } } CodeFluent.Runtime.CodeFluentEntityState userState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; if ((user != null)) { userState = user.EntityState; } this._rolesUserUsers = user; this.BaseList.Clear(); this.BaseTable.Clear(); int count = 0; int readCount = 0; bool readerRead; for (readerRead = reader.Read(); ((readerRead == true) && ((count < this.MaxCount) && (count < pageSize))); readerRead = reader.Read()) { readCount = (readCount + 1); if ((CodeFluent.Runtime.CodeFluentPersistence.CanAddEntity(pageIndex, pageSize, pageOptions, readCount) == true)) { ModelCodeFluent.Identity.Role role = new ModelCodeFluent.Identity.Role(); ((CodeFluent.Runtime.ICodeFluentEntity)(role)).ReadRecord(reader); if ((this.BaseContains(role) == false)) { this.BaseAdd(role); count = (count + 1); } role.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; } } if ((user != null)) { user.EntityState = userState; } }
internal void SaveUsersRelations() { if ((this._users == null)) { return; } System.Collections.IEnumerator enumerator = ((CodeFluent.Runtime.ICodeFluentSet)(this._users)).Relations.GetEnumerator(); bool b; for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext()) { System.Collections.DictionaryEntry entry = ((System.Collections.DictionaryEntry)(enumerator.Current)); ModelCodeFluent.Identity.User user = ((ModelCodeFluent.Identity.User)(entry.Key)); CodeFluent.Runtime.CodeFluentRelationType relationType = ((CodeFluent.Runtime.CodeFluentRelationType)(entry.Value)); if (((relationType == CodeFluent.Runtime.CodeFluentRelationType.Added) && ((user.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked) == false))) { CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "User", "SaveRoleUsers"); persistence.AddParameter("@Role_Id", this.Id, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@User_Id", user.Id, CodeFluentPersistence.DefaultGuidValue); persistence.ExecuteNonQuery(); } else { CodeFluent.Runtime.CodeFluentPersistence persistence1 = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence; persistence1.CreateStoredProcedureCommand(null, "User", "DeleteRoleUsers"); persistence1.AddParameter("@Role_Id", this.Id, CodeFluentPersistence.DefaultGuidValue); persistence1.AddParameter("@User_Id", user.Id, CodeFluentPersistence.DefaultGuidValue); persistence1.ExecuteNonQuery(); } if ((user.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked)) { user.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; } } ((CodeFluent.Runtime.ICodeFluentSet)(this._users)).Relations.Clear(); }
public static System.Data.IDataReader DataLoadRolesUsersByUser(ModelCodeFluent.Identity.User user) { System.Data.IDataReader reader = ModelCodeFluent.Identity.RoleCollection.PageDataLoadRolesUsersByUser(null, user); return(reader); }
public static System.Data.IDataReader PageDataLoadRolesUsersByUser(CodeFluent.Runtime.PageOptions pageOptions, ModelCodeFluent.Identity.User user) { if ((user == null)) { return(null); } if ((user.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "ModelCodeFluent.Identity.User"); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Role", "LoadRolesUsersByUser"); persistence.AddParameter("@UserId", user.Id, CodeFluentPersistence.DefaultGuidValue); if ((pageOptions != null)) { System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator(); bool b; int index = 0; for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext()) { CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current)); persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name); persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction))); index = (index + 1); } } System.Data.IDataReader reader = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence.ExecuteReader(); return(reader); }
public static ModelCodeFluent.Identity.RoleCollection LoadRolesUsersByUser(ModelCodeFluent.Identity.User user) { ModelCodeFluent.Identity.RoleCollection ret = ModelCodeFluent.Identity.RoleCollection.PageLoadRolesUsersByUser(int.MinValue, int.MaxValue, null, user); return(ret); }
public static ModelCodeFluent.Identity.RoleCollection PageLoadRolesUsersByUser(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, ModelCodeFluent.Identity.User user) { if ((pageIndex < 0)) { pageIndex = 0; } if ((pageSize < 0)) { if ((pageOptions != null)) { pageSize = pageOptions.DefaultPageSize; } else { pageSize = int.MaxValue; } } ModelCodeFluent.Identity.RoleCollection ret = new ModelCodeFluent.Identity.RoleCollection(); System.Data.IDataReader reader = null; try { reader = ModelCodeFluent.Identity.RoleCollection.PageDataLoadRolesUsersByUser(pageOptions, user); if ((reader == null)) { return(ret); } ret.LoadRolesUsersByUser(pageIndex, pageSize, pageOptions, reader, user); } finally { if ((reader != null)) { reader.Dispose(); } CodeFluent.Runtime.CodeFluentPersistence.CompleteCommand(ModelCodeFluent.Constants.ModelCodeFluentStoreName); } return(ret); }
public RoleCollection(ModelCodeFluent.Identity.User rolesUserUsers) { this._blm1274680529 = new CodeFluent.Runtime.Utilities.BindingListManager <ModelCodeFluent.Identity.Role>(this); this._rolesUserUsers = rolesUserUsers; }
public UserLoginCollection(ModelCodeFluent.Identity.User loginsUserUser) { this._blm2262660159 = new CodeFluent.Runtime.Utilities.BindingListManager <ModelCodeFluent.Identity.UserLogin>(this); this._loginsUserUser = loginsUserUser; }
public UserClaimCollection(ModelCodeFluent.Identity.User claimsUserUser) { this._blm2033613734 = new CodeFluent.Runtime.Utilities.BindingListManager <ModelCodeFluent.Identity.UserClaim>(this); this._claimsUserUser = claimsUserUser; }