public List <UserMaster> GetUsers() { List <UserMaster> ret = new List <UserMaster>(); DataTable result = _Database.Select(USER_TABLE, null, null, null, null, null); if (result != null && result.Rows.Count > 0) { foreach (DataRow row in result.Rows) { ret.Add(UserMaster.FromDataRow(row)); } } return(ret); }
public UserMaster GetUserByEmail(string email) { if (String.IsNullOrEmpty(email)) { throw new ArgumentNullException(nameof(email)); } Expression e = new Expression("Email", Operators.Equals, email); DataTable result = _Database.Select(USER_TABLE, null, null, null, e, null); if (result != null && result.Rows.Count > 0) { return(UserMaster.FromDataRow(result.Rows[0])); } return(null); }
public UserMaster GetUserById(int?id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } Expression e = new Expression("Id", Operators.Equals, id); DataTable result = _Database.Select(USER_TABLE, null, null, null, e, null); if (result != null && result.Rows.Count > 0) { return(UserMaster.FromDataRow(result.Rows[0])); } return(null); }
private T DataTableToObject <T>(DataTable result) where T : class { if (result == null || result.Rows.Count < 1) { return(null); } if (typeof(T) == typeof(ApiKey)) { return(ApiKey.FromDataRow(result.Rows[0]) as T); } else if (typeof(T) == typeof(UserMaster)) { return(UserMaster.FromDataRow(result.Rows[0]) as T); } else if (typeof(T) == typeof(Permission)) { return(Permission.FromDataRow(result.Rows[0]) as T); } else if (typeof(T) == typeof(UrlLock)) { return(UrlLock.FromDataRow(result.Rows[0]) as T); } else if (typeof(T) == typeof(Container)) { return(Container.FromDataRow(result.Rows[0]) as T); } else if (typeof(T) == typeof(ObjectMetadata)) { return(ObjectMetadata.FromDataRow(result.Rows[0]) as T); } else if (typeof(T) == typeof(ContainerKeyValuePair)) { return(ContainerKeyValuePair.FromDataRow(result.Rows[0]) as T); } else if (typeof(T) == typeof(ObjectKeyValuePair)) { return(ObjectKeyValuePair.FromDataRow(result.Rows[0]) as T); } else if (typeof(T) == typeof(AuditLogEntry)) { return(AuditLogEntry.FromDataRow(result.Rows[0]) as T); } throw new ArgumentException("Unknown object type: " + typeof(T).Name); }