示例#1
0
        private ChartInfo GetWorkedTimeVsDayData(GenerateChartArguments args)
        {
            ChartPointsList workedTimeList   = new ChartPointsList();
            ChartPointsList activeTimeList   = new ChartPointsList();
            ChartPointsList inactiveTimeList = new ChartPointsList();
            ChartInfo       info             = new ChartInfo();

            info.Arguments = args;

            DateTime curDate = args.FromDate;
            DateTime toDate  = args.ToDate;

            while (curDate <= toDate)
            {
                if (worker.CancellationPending)
                {
                    return(null);
                }
                int workedTime = TasksSummaries.GetWorkedTime(curDate, curDate);
                if (workedTime != 0)
                {
                    int    activeTime   = TasksSummaries.GetActiveTime(curDate, curDate);
                    int    inactiveTime = workedTime - activeTime;
                    string date         = curDate.ToShortDateString();
                    info.AddX(date);
                    workedTimeList.Add(Convert.ToDouble(workedTime * 1.0 / 3600));
                    activeTimeList.Add(Convert.ToDouble(activeTime * 1.0 / 3600));
                    inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 1.0 / 3600));
                }
                curDate = curDate.AddDays(1);
            }
            info.PointsList = new ChartPointsList[] { workedTimeList, activeTimeList, inactiveTimeList };
            return(info);
        }
示例#2
0
        private ChartInfo GetPercentActiveTimeVsMonthData(GenerateChartArguments args)
        {
            ChartPointsList activeTimeList   = new ChartPointsList();
            ChartPointsList inactiveTimeList = new ChartPointsList();
            ChartInfo       info             = new ChartInfo();

            info.Arguments = args;

            DateTime curDate = args.FromDate;
            DateTime toDate  = args.ToDate;

            while (curDate <= toDate)
            {
                if (worker.CancellationPending)
                {
                    return(null);
                }

                DateTime endcurDate = curDate.AddMonths(1).AddSeconds(-1);
                int      workedTime = TasksSummaries.GetWorkedTime(curDate, endcurDate);
                if (workedTime != 0)
                {
                    int    activeTime   = TasksSummaries.GetActiveTime(curDate, endcurDate);
                    int    inactiveTime = workedTime - activeTime;
                    string month        = curDate.ToString("MMM-yyyy");
                    info.AddX(month);
                    activeTimeList.Add(Convert.ToDouble(activeTime * 100.0 / workedTime));
                    inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 100.0 / workedTime));
                }
                curDate = curDate.AddMonths(1);
            }
            info.PointsList = new ChartPointsList[] { activeTimeList, inactiveTimeList };
            return(info);
        }
示例#3
0
        private ChartInfo GetWorkedTimeVsWeekData(GenerateChartArguments args)
        {
            ChartPointsList workedTimeList = new ChartPointsList();
            ChartPointsList activeTimeList = new ChartPointsList();
            ChartPointsList inactiveTimeList = new ChartPointsList();
            ChartInfo info = new ChartInfo();
            info.Arguments = args;

            DateTime curDate = args.FromDate;
            DateTime toDate = args.ToDate;

            while (curDate <= toDate)
            {
                if (worker.CancellationPending)
                    return null;

                DateTime endcurDate = curDate.AddDays(7).AddSeconds(-1);
                int workedTime = TasksSummaries.GetWorkedTime(curDate, endcurDate);
                if (workedTime != 0)
                {
                    int activeTime = TasksSummaries.GetActiveTime(curDate, endcurDate);
                    int inactiveTime = workedTime - activeTime;
                    string week = curDate.ToShortDateString() + "-" + endcurDate.ToShortDateString();
                    info.AddX(week);
                    workedTimeList.Add(Convert.ToDouble(workedTime * 1.0 / 3600));
                    activeTimeList.Add(Convert.ToDouble(activeTime * 1.0 / 3600));
                    inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 1.0 / 3600));
                }
                curDate = curDate.AddDays(7);
            }
            info.PointsList = new ChartPointsList[] { workedTimeList, activeTimeList, inactiveTimeList };
            return info;
        }
示例#4
0
        private ChartInfo GetPercentActiveTimeVsMonthData(GenerateChartArguments args)
        {
            ChartPointsList activeTimeList = new ChartPointsList();
            ChartPointsList inactiveTimeList = new ChartPointsList();
            ChartInfo info = new ChartInfo();
            info.Arguments = args;

            DateTime curDate = args.FromDate;
            DateTime toDate = args.ToDate;

            while (curDate <= toDate)
            {
                if (worker.CancellationPending)
                    return null;

                DateTime endcurDate = curDate.AddMonths(1).AddSeconds(-1);
                int workedTime = TasksSummaries.GetWorkedTime(curDate, endcurDate);
                if (workedTime != 0)
                {
                    int activeTime = TasksSummaries.GetActiveTime(curDate, endcurDate);
                    int inactiveTime = workedTime - activeTime;
                    string month = curDate.ToString("MMM-yyyy");
                    info.AddX(month);
                    activeTimeList.Add(Convert.ToDouble(activeTime * 100.0 / workedTime));
                    inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 100.0 / workedTime));
                }
                curDate = curDate.AddMonths(1);
            }
            info.PointsList = new ChartPointsList[] { activeTimeList, inactiveTimeList };
            return info;
        }
示例#5
0
        private ChartInfo GetPercentActiveTimeVsDayData(GenerateChartArguments args)
        {
            ChartPointsList activeTimeList = new ChartPointsList();
            ChartPointsList inactiveTimeList = new ChartPointsList();
            ChartInfo info = new ChartInfo();
            info.Arguments = args;

            DateTime curDate = args.FromDate;
            DateTime toDate = args.ToDate;
            while (curDate <= toDate)
            {
                if (worker.CancellationPending)
                    return null;
                int workedTime = TasksSummaries.GetWorkedTime(curDate, curDate);
                if (workedTime != 0)
                {
                    int activeTime = TasksSummaries.GetActiveTime(curDate, curDate);
                    int inactiveTime = workedTime - activeTime;
                    string date = curDate.ToShortDateString();
                    info.AddX(date);
                    activeTimeList.Add(Convert.ToDouble(activeTime * 100.0 / workedTime));
                    inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 100.0 / workedTime));
                }
                curDate = curDate.AddDays(1);
            }

            info.PointsList = new ChartPointsList[] { activeTimeList, inactiveTimeList };
            return info;
        }