示例#1
0
        public void ShowDialogNewProject()
        {
            var newCurrentProject = new DialogDefineProjects().ShowDialogNewProject(ProjectHandler);

            if (newCurrentProject != null)
            {
                ProjectCorrectionHandler.addNewCurrentProject(newCurrentProject.ProjectName, newCurrentProject.Comment);
            }
        }
示例#2
0
        public void ShowDialogSplitCurrentProject()
        {
            List <WorktimeRecord> projects = new DialogDefineProjects().ShowDialogDistraction(ProjectHandler);

            if (projects != null && projects.Count > 0)
            {
                ProjectCorrectionHandler.splitCurrentProject(projects);
            }
        }
示例#3
0
        public void ShowDialogAddComment()
        {
            //new DialogDefineProjects().ShowDialogChangeCurrentProject(ProjectHandler);

            List <WorktimeRecord> projects = new DialogDefineProjects().ShowDialogSince(ProjectHandler);

            if (projects != null && projects.Count > 0)
            {
                ProjectCorrectionHandler.splitCurrentProject(projects);
            }
        }
示例#4
0
        public override bool process(ProjectChangeEvent projectChangeEvent)
        {
            if (projectChangeEvent.Type == ProjectChangeEvent.Types.Lock)
            {
                //Hack: Just replace event data instead of refiring, because the old event is per definition invalid
                projectChangeEvent.Type = ProjectChangeEvent.Types.Finish;
                return(false);
            }
            if (projectChangeEvent.Type == ProjectChangeEvent.Types.Unlock)
            {
                var outlookAppointments = Util.OutlookAppointmentRetriever.retrieveAppointments(
                    projectChangeEvent.WorktimeRecord.Start, projectChangeEvent.WorktimeRecord.End);

                List <WorktimeRecord> breakTimes = new DialogDefineProjects().ShowDialogMeantime(
                    projectChangeEvent.WorktimeRecord.Start,
                    projectChangeEvent.WorktimeRecord.End,
                    Handler,
                    outlookAppointments);

                if (breakTimes != null && breakTimes.Count > 0)
                {
                    var currentProject = breakTimes.Last();
                    breakTimes.Remove(currentProject);

                    foreach (var brk in breakTimes)
                    {
                        OnRaiseProjectChangeEvent(new ProjectChangeEvent(
                                                      ProjectChangeEvent.Types.Start,
                                                      currentProject.ProjectName,
                                                      currentProject.Comment,
                                                      brk));
                    }
                }
                return(true);
            }
            return(false);
        }