Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public static Habit UpdateHabit(Guid id, Guid userID, string name, IGainer logGainer)
 {
     return(new Habit(id, userID, name, logGainer));
 }
Exemplo n.º 4
0
 public static Habit NewHabit(string name, Guid userID, IGainer logGainer)
 {
     return(new Habit(Guid.NewGuid(), userID, name, new Logs(), new Streak(), logGainer));
 }
Exemplo n.º 5
0
 public Habit(Guid id, Guid user, string name, IGainer logGainer) : this(id, user, name, new Logs(1), new Streak(0, 0), logGainer)
 {
 }
Exemplo n.º 6
0
 public Bonus(int multiple, IGainer wrappee)
 {
     _multiple = multiple;
     _wrappee  = wrappee;
 }
Exemplo n.º 7
0
 public FailHandler(IGainer gainer) : base(gainer)
 {
 }
Exemplo n.º 8
0
 public SuccessHandler(IGainer gainer) : base(gainer)
 {
 }
Exemplo n.º 9
0
 public HabitResultHandler(IGainer gainer)
 {
     _gainer    = gainer;
     connString = "Host=localhost;Username=Habit;Password=revarino123;Database=HabitTracker;Port=5432";
 }