public Habit(Guid id, Guid user, string name, Logs count, Streak value, IGainer logGainer) { if (name == null) { throw new Exception("Name cannot be null"); } if (name.Length < 2 || name.Length > 100) { throw new Exception("Name must between 2 and 100"); } this._id = id; this._users = user; this._name = name; this._daysoff = new List <String>(); this._logs = count; this._streak = value; this._logGainer = logGainer; }
public static Habit Create(String habit_name, String[] days, Guid user, IGainer logGainer) { if (!checkDays(days)) { return(null); } Habit habit = Habit.NewHabit(habit_name, user, logGainer); foreach (String item in days) { if ((item != "Mon") && (item != "Tue") && (item != "Wed") && (item != "Thu") && (item != "Fri") && (item != "Sat") && (item != "Sun")) { throw new Exception("Must be 3 words!"); } } foreach (String x in days) { habit.AddDaysOff(x); } habit.AddLogs(); return(habit); }
public static Habit UpdateHabit(Guid id, Guid userID, string name, IGainer logGainer) { return(new Habit(id, userID, name, logGainer)); }
public static Habit NewHabit(string name, Guid userID, IGainer logGainer) { return(new Habit(Guid.NewGuid(), userID, name, new Logs(), new Streak(), logGainer)); }
public Habit(Guid id, Guid user, string name, IGainer logGainer) : this(id, user, name, new Logs(1), new Streak(0, 0), logGainer) { }
public Bonus(int multiple, IGainer wrappee) { _multiple = multiple; _wrappee = wrappee; }
public FailHandler(IGainer gainer) : base(gainer) { }
public SuccessHandler(IGainer gainer) : base(gainer) { }
public HabitResultHandler(IGainer gainer) { _gainer = gainer; connString = "Host=localhost;Username=Habit;Password=revarino123;Database=HabitTracker;Port=5432"; }