示例#1
0
        //# p = Project ID#, c = comment
        //# ex: sumhours(5/1/2008, 4, "PDR")
        //# use p=0 to ignore project ID
        //# use c="" to ignore comments
        public List<StatisticEntry> sumhours(DateTime startDate, DateTime endDate, int p, string c)
        {
            dat.DataTable hours = this._Hours.List();

            string where = "";
            where += "StartDate >= #" + startDate.ToShortDateString() + "#";
            where += " AND StartDate < #" + endDate.AddDays(1).ToShortDateString() + "#";

            // this can be useful elsewhere
            //if (start.DayOfWeek != System.DayOfWeek.Sunday)
            //{
            //    string warning = "* * * * NOTE: Converting " + start.ToString("d") + " to Sunday's date: ";
            //    start = start.AddDays(System.Convert.ToInt32(start.DayOfWeek) * -1);
            //    warning += start.ToString("d");
            //    Console.WriteLine(warning);
            //}
            //where += "StartDate >= #" + start.ToShortDateString() + "#";
            //where += "AND StartDate < #" + start.AddDays(daySpan).ToShortDateString() + "#";

            if (p != 0)
                where += " AND ProjectID = " + p.ToString();
            if (c != "")
                where += " AND Comments LIKE '%" + c.ToString() + "%'";

            dat.DataTable projects = this._Projects.List();
            string project = "";
            if (p != 0)
                project = projects.Select("ProjectID = '" + p.ToString() + "'")[0]["Description"].ToString();

            List<StatisticEntry> hourStats = new List<StatisticEntry>();
            foreach (dat.DataRow dr in hours.Select(where))
            {
                if (p == 0)
                {
                    string pid = dr["ProjectID"].ToString();
                    dat.DataRow[] selectedProjects = projects.Select("ProjectID = '" + pid + "'");
                    if (selectedProjects.Length == 1)
                        project = selectedProjects[0]["Description"].ToString();
                    else
                        project = "(missing project for #" + pid + ")";
                }

                StatisticEntry hourRow = new StatisticEntry(project, Convert.ToDecimal(dr["Hours"]), dr["Comments"].ToString(),
                    Convert.ToDateTime(dr["StartDate"]));
                hourStats.Add(hourRow);
            }
            return hourStats;
        }
示例#2
0
        public static StatisticEntry GetBossStatisticEntryFromNetID(short netID)
        {
            StatisticEntry result = StatisticEntry.Unknown;

            switch (netID)
            {
            case 50:
                result = StatisticEntry.KingSlime;
                break;

            case 4:
                result = StatisticEntry.EyeOfCthulhu;
                break;

            case 13:
            case 14:
            case 15:
                result = StatisticEntry.EaterOfWorlds;
                break;

            case 35:
                result = StatisticEntry.Skeletron;
                break;

            case 113:
                result = StatisticEntry.WallOfFlesh;
                break;

            case 125:
            case 126:
                result = StatisticEntry.TheTwins;
                break;

            case 134:
                result = StatisticEntry.TheDestroyer;
                break;

            case 127:
                result = StatisticEntry.SkeletronPrime;
                break;

            case 166:
                result = StatisticEntry.Ocram;
                break;
            }
            return(result);
        }
示例#3
0
 public void incStat(StatisticEntry entry)
 {
     if (entry != StatisticEntry.Unknown)
     {
         if (entry < StatisticEntry.EyeOfCthulhu)
         {
             SlimesKilled.Set((int)entry, value: true);
             UpdateAllSlimesKilled();
         }
         if (entry < StatisticEntry.AirTravel && entry >= StatisticEntry.KingSlime)
         {
             int index = (int)(entry - 18);
             BossesKilled.Set(index, value: true);
             UpdateAllBossesKilled();
         }
         Counters[(int)entry]++;
     }
 }
示例#4
0
        public static StatisticEntry GetStatisticEntryFromNetID(short netID)
        {
            StatisticEntry result = StatisticEntry.Unknown;

            switch (netID)
            {
            case 1:
                result = StatisticEntry.BlueSlime;
                break;

            case -1:
                result = StatisticEntry.Slimeling;
                break;

            case -2:
                result = StatisticEntry.Slimer;
                break;

            case -3:
                result = StatisticEntry.GreenSlime;
                break;

            case -4:
                result = StatisticEntry.Pinky;
                break;

            case -5:
                result = StatisticEntry.BabySlime;
                break;

            case -6:
                result = StatisticEntry.BlackSlime;
                break;

            case -7:
                result = StatisticEntry.PurpleSlime;
                break;

            case -8:
                result = StatisticEntry.RedSlime;
                break;

            case -9:
                result = StatisticEntry.YellowSlime;
                break;

            case -10:
                result = StatisticEntry.JungleSlime;
                break;

            case -18:
                result = StatisticEntry.Slimeling;
                break;

            case 16:
                result = StatisticEntry.MotherSlime;
                break;

            case 59:
                result = StatisticEntry.LavaSlime;
                break;

            case 81:
                result = StatisticEntry.CorruptSlime;
                break;

            case 141:
                result = StatisticEntry.ToxicSludge;
                break;

            case 121:
                result = StatisticEntry.Slimer;
                break;

            case 150:
                result = StatisticEntry.ShadowSlime;
                break;

            case 138:
                result = StatisticEntry.IlluminantSlime;
                break;

            case 71:
                result = StatisticEntry.DungeonSlime;
                break;
            }
            return(result);
        }
示例#5
0
 public uint this[StatisticEntry stat] => Counters[(int)stat];
示例#6
0
        private static ColumnMapping Map(StatisticEntry entry, Column column)
        {
            string name = column.ToString();

            return(new ColumnMapping(entry, column, name));
        }
示例#7
0
 public ColumnMapping(StatisticEntry entry, Column column, string name)
 {
     Statistic  = entry;
     Column     = column;
     ColumnName = name;
 }