public static T Get <T>(this IEnumerable <T> list, WebAppDatabase database, int?id) where T : class, IEntity { var result = list.Get(id); if (result != null) { result.Database = database; } var onLoad = result as IOnLoad; if (onLoad != null) { onLoad.OnLoad(); } return(result); }
public static WebAppDatabase Login(string username, string password) { if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password)) { throw new SystemException("Username Password combination invalid."); } var database = new WebAppDatabase(username); var user = database.Users.FirstOrDefault(x => x.Username == username); if (user == null || !user.Active) { throw new SystemException("Username Password combination invalid."); } return(database); }
public void OnSave(WebAppDatabase database) { var errors = new StringBuilder(); errors.AppendError(database.Users.Any(x => x.Username == Username && x.ID != ID), $"The username [{Username}] is already in use."); errors.AppendError(string.IsNullOrWhiteSpace(Username), "User requires a username"); errors.AppendError(string.IsNullOrWhiteSpace(Password), "User requires a password"); errors.AppendError(Password.IsRegexMatch("^(?=.*[0-9]).{1,}$"), "Requires 1 number."); errors.AppendError(Password.IsRegexMatch("^(?=.*[a-z]).{1,}$"), "Requires 1 lower case letter."); errors.AppendError(Password.IsRegexMatch("^(?=.*[A-Z]).{1,}$"), "Requires 1 upper case letter."); errors.AppendError(Password.IsRegexMatch("[^a-zA-Z0-9 ]"), "Requires 1 special character."); errors.AppendError(Password.Length < 8, "Minimun length of 8."); errors.AppendError(UserTypeID == 0, "User requires a type"); errors.ErrorCheck(); }
public ProductType(WebAppDatabase database) : this() { Database = database; }
public OrderDetail(WebAppDatabase database) : this() { Database = database; }
public User(WebAppDatabase database) : this() { Database = database; }
public static T Get <T>(this IEnumerable <T> set, WebAppDatabase database, Enum id) where T : class, IEntity { return(set.Get(database, Convert.ToInt32(id))); }
public static T Get <T>(this WebAppDatabase db, int?id) where T : class, IEntity { return(db.Set <T>().Get(db, id)); }
public ActivityType(WebAppDatabase database) : this() { Database = database; }
public UserActivity(WebAppDatabase database) : this() { Database = database; }
public LineItem(WebAppDatabase database) : this() { Database = database; }