Ejemplo n.º 1
0
        public void StartNewDuty()
        {
            //first we have to pause current ongoing duty
            PauseCurrentDuty();

            Duty duty = new Duty();

            //first timeframe
            DutyTimeFrame ttf = new DutyTimeFrame();
            duty.TimeFrames.Add(ttf);

            duty.Name = string.Format("{0}: {1}", Lang.TaskName_Default, ttf.ToString());

            duty.Status = (int)DutyStatus.Ongoing;

            _Iteration.Duties.Add(duty);
            OngoingDuty = duty;
        }
Ejemplo n.º 2
0
        private void InitTestStatistics()
        {
            Random rnd = new Random();
            Statistics = new ObservableCollection<DutyWrapper>();

            List<DutyGroup> listGroup = new List<DutyGroup>();
            listGroup.Add(new DutyGroup() { Name = "Programiranje" });
            listGroup.Add(new DutyGroup() { Name = "Support" });
            listGroup.Add(new DutyGroup() { Name = "Testiranje" });
            listGroup.Add(new DutyGroup() { Name = "Dokumentacija" });

            List<DutyWrapper> listDuties = new List<DutyWrapper>();

            for (int i = 0; i < 100; i++)
            {
                Duty dut = new Duty("Task " + i);
                dut.TimeFrames.Clear();
                DutyTimeFrame frame = new DutyTimeFrame();
                frame.From = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 20, 0, 0);
                frame.To = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 21, 0, 0);
                dut.TimeFrames.Add(frame);
                int r = rnd.Next(4);
                dut.Group = listGroup[r];

                int s = rnd.Next(5);
                listDuties.Add(new DutyWrapper() { Duty = dut, Number = s, Display = dut.Group.Name });
                //dut.TotalTimeSpent
            }

            foreach (DutyWrapper dutWrap in listDuties)
            {
                DutyWrapper realWrapper = Statistics.FirstOrDefault(a => a.Display == dutWrap.Duty.Group.Name);

                if (realWrapper != null)
                {
                    realWrapper.Number += dutWrap.Number;
                }
                else
                {
                    Statistics.Add(dutWrap);
                }
            }
        }
Ejemplo n.º 3
0
        private void FinishDuty(Duty duty)
        {
            if (duty != null)
            {
                if (duty.Status != (int)DutyStatus.Completed)
                {
                    //lets close last time frame
                    DutyTimeFrame lastTimeFrame = duty.TimeFrames.Last();

                    lastTimeFrame.To = DateTime.Now;

                    duty.Status = (int)DutyStatus.Completed;
                }
            }
        }
Ejemplo n.º 4
0
        public void SetIteration(Iteration iteration)
        {
            Iteration = iteration;

            OngoingDuty = iteration.Duties.FirstOrDefault(a => a.Status == (int)DutyStatus.Ongoing);
        }
Ejemplo n.º 5
0
 public void StartNewIteration()
 {
     //we have to prepaire provider for new iteration
     Iteration = new Iteration();
     OngoingDuty = null;
 }
Ejemplo n.º 6
0
        public void UnpauseDuty(Duty duty)
        {
            if(_OngoingDuty != duty)
            {
                //first we have to pause current ongoing duty
                PauseCurrentDuty();

                duty.TimeFrames.Add(new DutyTimeFrame() { From = DateTime.Now });
                duty.Status = (int)DutyStatus.Ongoing;
                _OngoingDuty = duty;
            }
        }