コード例 #1
0
        public override void Update(HabitResult e)
        {
            Fail ev = e as Fail;

            if (ev == null)
            {
                return;
            }
            ev._habit.AddStreak(_gainer.Gain());
        }
コード例 #2
0
        public override void Update(HabitResult e)
        {
            Success ev = e as Success;

            if (ev == null)
            {
                return;
            }
            NpgsqlConnection _connection = new NpgsqlConnection(connString);

            _connection.Open();
            IHabitRepository repo1 = new HabitRepository(_connection, null);

            if (repo1.getLastLog(ev._habit.ID) != 0)
            {
                repo1.AddStreak(ev._habit.ID, _gainer.Gain());

                repo1.GiveBadge(ev._habit.ID);
            }
            else
            {
                repo1.AddStreak(ev._habit.ID, 0);
            }
        }