Exemplo n.º 1
0
 private ContextCategoryView CreateCategoryModel(ContextCategory model)
 {
     return(new ContextCategoryView
     {
         Id = model.Id,
         Name = model.Name,
         CreatedOn = model.CreatedOn
     });
 }
Exemplo n.º 2
0
        protected string MakeInsertOrUpdateContextCategoryQuery(ContextCategory contextCategory)
        {
            var query = string.IsNullOrEmpty(contextCategory.Id)
                ? $"INSERT INTO categories(id, tid, name, createdOn) " +
                        $"VALUES('$NEWID', '{contextCategory.TournamentId}', '{contextCategory.Name}','{DateTimeToStr(contextCategory.CreatedOn)}');"
                : $"UPDATE categories SET name='{contextCategory.Name}', " +
                        $"endedOn='{DateTimeToStr(contextCategory.EndedOn)}' where id = '{contextCategory.Id}'";

            return(query);
        }
Exemplo n.º 3
0
        private static bool IsCategory(ContextCategory category, string processName, string windowName)
        {
            var listToCheck = GetListForCategory(category);

            if (listToCheck == null)
            {
                return(false);
            }
            return(listToCheck.Any(processName.Contains) || listToCheck.Any(windowName.Contains));
        }
Exemplo n.º 4
0
        private ContextCategory MakeContextCategory(MySqlDataReader record)
        {
            var cat = new ContextCategory
            {
                Id           = record["id"].ToString(),
                TournamentId = record["tid"].ToString(),
                Name         = record["name"].ToString(),
                CreatedOn    = ToDateTime(record["createdOn"].ToString())
            };

            if (!string.IsNullOrEmpty(record["endedOn"].ToString()))
            {
                cat.EndedOn = ToDateTime(record["endedOn"].ToString());
            }

            return(cat);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Return a screen name for the activity category
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        private static string GetDescriptionForContextCategory(ContextCategory category)
        {
            switch (category)
            {
            case ContextCategory.DevCode:
                return("Development (Coding)");

            case ContextCategory.DevDebug:
                return("Debugging");

            case ContextCategory.DevReview:
                return("Reviewing");

            case ContextCategory.ReadWriteDocument:
                return("Reading/Editing documents");

            case ContextCategory.InformalMeeting:
                return("Ad-hoc meetings");

            case ContextCategory.PlannedMeeting:
                return("Scheduled meetings/calls");

            case ContextCategory.Planning:
                return("Planning tasks/work items");

            case ContextCategory.Email:
                return("Reading/writing emails");

            case ContextCategory.WorkRelatedBrowsing:
                return("Work related browsing");

            case ContextCategory.WorkUnrelatedBrowsing:
                return("Work un-related browsing");

            case ContextCategory.Other:
                return("Uncategorized activities");

            case ContextCategory.None:
                return("Offline (e.g. break, lunch)");
            }

            return("??"); // default color
        }
Exemplo n.º 6
0
        /// <summary>
        /// Return a color for each context category
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        private static string GetHtmlColorForContextCategory(ContextCategory category)
        {
            switch (category)
            {
            case ContextCategory.DevCode:
                return("#007acb");    // darker blue

            case ContextCategory.DevDebug:
                return("#8EC4E8");    // fairest blue

            case ContextCategory.DevReview:
                return("#1484CE");    //fairest blue

            case ContextCategory.ReadWriteDocument:
                return("#36c1c4");    // another blue

            case ContextCategory.PlannedMeeting:
                return("#00b300");    // dark green

            case ContextCategory.InformalMeeting:
                return("#00cc00");    // fair green

            case ContextCategory.Planning:
                return("#e855e8");    // dark violett

            case ContextCategory.Email:
                return("#f198f1");    // fair violett

            case ContextCategory.WorkRelatedBrowsing:
                return("#FF7F0E");    //orange

            case ContextCategory.WorkUnrelatedBrowsing:
                return("#FFBB78");    // fair orange

            case ContextCategory.Other:
                return("gray");

            case ContextCategory.None:
                return(NoneColor);
            }

            return(NoneColor); //"#007acb"; // default color
        }
Exemplo n.º 7
0
        public string AddOrUpdateContextCategory(ContextCategory contextCategory)
        {
            try
            {
                this.logProvider.Info(
                    $"SqlTradingRepository, CreateOrUpdateTournament, id='{contextCategory.Id}', name='{contextCategory.Name}'");

                var query = this.MakeInsertOrUpdateContextCategoryQuery(contextCategory);
                var newId = GenerateNewId();
                query = query.Replace("$NEWID", newId);

                var dbResult = this.ExecuteNonQuery(query);

                return(dbResult == 1 ? newId : null);
            }
            catch (Exception ex)
            {
                this.logProvider.Error($"SqlTradingRepository, CreateOrUpdateTournament, id='{contextCategory.Id}', name='{contextCategory.Name}'", ex);
                throw;
            }
        }
Exemplo n.º 8
0
        private static List <string> GetListForCategory(ContextCategory cat)
        {
            switch (cat)
            {
            case ContextCategory.DevCode:
                return(CodingApps);

            case ContextCategory.DevDebug:
                return(CodingDebugApps);

            case ContextCategory.DevReview:
                return(CodingReviewApps);

            case ContextCategory.DevVc:
                return(CodingVersionControlApps);

            case ContextCategory.Email:
                return(EmailApps);

            case ContextCategory.Planning:
                return(PlanningApps);

            case ContextCategory.ReadWriteDocument:
                return(ReadingWritingApps);

            case ContextCategory.InformalMeeting:
                return(InstantMessagingApps);

            case ContextCategory.Other:
                return(OtherApps);

            case ContextCategory.OtherRdp:
                return(OtherRdpApps);
            }
            return(null);
        }
Exemplo n.º 9
0
 public string AddOrUpdateContextCategory(ContextCategory contextCategory)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
 public void TestContextCategory()
 {
     RegressionRunner.Run(session, ContextCategory.Executions());
 }