コード例 #1
0
        public HistoryActivity(ref Canvas canvas)
        {
            this.canvas   = canvas;
            allData_db    = new AllData_db();
            mainCanvas    = CanvasCreator.CreateCanvas(canvas, 620, 410, Color.FromArgb(255, 226, 240, 255), 0, 0);
            contentCanvas = CanvasCreator.CreateCanvas(mainCanvas, 620, 360, Color.FromArgb(255, 236, 236, 236), 0, 50);
            new MyRectangle(mainCanvas, 620, 1, Color.FromArgb(60, 110, 110, 110), 0, 50);

            MyLabel l = new MyLabel(mainCanvas, "Historia aktywności", 200, 38, 18, 30, 10, Color.FromArgb(255, 0, 123, 255), Color.FromArgb(200, 0, 56, 255));

            l.SetFont("Verdana");

            new MyLabel(mainCanvas, "x", 30, 50, 24, 590, 10, Color.FromArgb(255, 70, 70, 70),
                        Color.FromArgb(255, 70, 70, 70), 0);
            Label buttonCloseActivityHistory = ButtonCreator.CreateButton(mainCanvas, "", 30, 30, 14, 590, 20,
                                                                          Color.FromArgb(0, 155, 155, 155), Color.FromArgb(0, 155, 155, 155), 0);

            buttonCloseActivityHistory.Background           = new SolidColorBrush(Color.FromArgb(180, 215, 215, 215));
            buttonCloseActivityHistory.MouseEnter          += buttonCloseActivityHistory_MouseEnter;
            buttonCloseActivityHistory.MouseLeave          += buttonCloseActivityHistory_MouseLeave;
            buttonCloseActivityHistory.MouseLeftButtonDown += buttonCloseActivityHistory_MouseLeftButtonDown;

            CreateDatePickier();
            CreateChart();
        }
コード例 #2
0
        private void UpdateTableWithInformation()
        {
            AllData_db allData_db = new AllData_db();
            List <int> activityID = new List <int>();

            activityID.Add(viewActivityID);
            double[, ,] valueQuery = new double[2, 2, 2];
            valueQuery[0, 0, 0]    = allData_db.GetTimeForNumberActivity(activityID, DateTime.Now.AddDays(-7).ToShortDateString(), DateTime.Now.ToShortDateString());
            valueQuery[1, 0, 0]    = allData_db.GetTimeForNumberActivity(activityID, DateTime.Now.AddDays(-30).ToShortDateString(), DateTime.Now.ToShortDateString());
            valueQuery[0, 1, 0]    = allData_db.GetTimeForNumberActivity(activityID, DateTime.Now.AddDays(-14).ToShortDateString(), DateTime.Now.AddDays(-7).ToShortDateString());
            valueQuery[1, 1, 0]    = allData_db.GetTimeForNumberActivity(activityID, DateTime.Now.AddDays(-60).ToShortDateString(), DateTime.Now.AddDays(-30).ToShortDateString());
            activityID.Clear();

            activityID.Add(-1); activityID.Add(-2);
            valueQuery[0, 0, 1] = allData_db.GetTimeForNumberActivity(activityID, DateTime.Now.AddDays(-7).ToShortDateString(), DateTime.Now.ToShortDateString(), true);
            valueQuery[1, 0, 1] = allData_db.GetTimeForNumberActivity(activityID, DateTime.Now.AddDays(-30).ToShortDateString(), DateTime.Now.ToShortDateString(), true);
            valueQuery[0, 1, 1] = allData_db.GetTimeForNumberActivity(activityID, DateTime.Now.AddDays(-14).ToShortDateString(), DateTime.Now.AddDays(-7).ToShortDateString(), true);
            valueQuery[1, 1, 1] = allData_db.GetTimeForNumberActivity(activityID, DateTime.Now.AddDays(-60).ToShortDateString(), DateTime.Now.AddDays(-30).ToShortDateString(), true);


            average[0].SetContent((ActionOnNumbers.DivisionD(valueQuery[0, 0, 0], valueQuery[0, 0, 1]) * 100).ToString("0.00") + " %");
            average[1].SetContent((ActionOnNumbers.DivisionD(valueQuery[1, 0, 0], valueQuery[1, 0, 1]) * 100).ToString("0.00") + " %");

            growth[0].SetContent(((ActionOnNumbers.DivisionD(valueQuery[0, 1, 0], valueQuery[0, 1, 1])
                                   - ActionOnNumbers.DivisionD(valueQuery[0, 0, 0], valueQuery[0, 0, 1])) * 100 * -1).ToString("0.00") + " %");
            growth[1].SetContent(((ActionOnNumbers.DivisionD(valueQuery[1, 1, 0], valueQuery[1, 1, 1])
                                   - ActionOnNumbers.DivisionD(valueQuery[1, 0, 0], valueQuery[1, 0, 1])) * 100 * -1).ToString("0.00") + " %");

            time[0].SetContent(ActionOnTime.GetTimeAndDays((int)valueQuery[0, 0, 0]));
            time[1].SetContent(ActionOnTime.GetTimeAndDays((int)valueQuery[1, 0, 0]));
        }
コード例 #3
0
        public StatisticsForm(Canvas contentPage, ref ViewContent viewContent)
        {
            this.contentPage = contentPage;
            this.viewContent = viewContent;
            viewContent.ContentDelegateLoad += viewContent_Delegate;
            allData_db = new AllData_db();

            CreateStatisticsForm();
        }
コード例 #4
0
        private void UpdateChart()
        {
            AllData_db allData_db = new AllData_db();
            DailyUseOfApplication_db dailyUseOfApplication_db = new DailyUseOfApplication_db();
            List <int> activityID = new List <int>();

            int[]    timeActivity = new int[7];
            DateTime dateTime     = DateTime.Now;

            activityID.Add(viewActivityID);

            for (int i = 0; i < 7; i++)
            {
                if (i < 6)
                {
                    timeActivity[i] = allData_db.GetTimeForNumberActivity(activityID, dateTime.AddDays(-(7 - (i + 1))).ToShortDateString());
                }
                else
                {
                    timeActivity[i] = dailyUseOfApplication_db.GetTimeForNumberActivity(activityID);
                }
            }

            double maxValue = ActionOnNumbers.DivisionD((timeActivity.Max() > 2) ? timeActivity.Max() : 3, 60);

            for (int i = 0; i < 4; i++)
            {
                scaleLabel[i].SetContent((((maxValue / 3.0) * 3) - ((maxValue / 3.0) * i)).ToString("0.0") + " h");
            }

            if (timeActivity.Max() > 0)
            {
                double scale = maxValue / Convert.ToDouble(scaleLabel[0].GetContent().Replace(" h", ""));
                for (int i = 0; i < 7; i++)
                {
                    charts[i].Resize((int)(timeActivity[i] * (120 * scale) / timeActivity.Max()), 16);
                    charts[i].Position(y: 200 - timeActivity[i] * (120 * scale / timeActivity.Max()));
                    charts[i].ToolTip(ActionOnTime.GetTime(timeActivity[i]));
                }
            }
            else
            {
                for (int i = 0; i < 7; i++)
                {
                    charts[i].Resize(0, 16);
                    charts[i].ToolTip(ActionOnTime.GetTime(timeActivity[i]));
                }
            }
            SetVisibleScale();
        }
コード例 #5
0
        private void GetDaysHistoryActivity()
        {
            AllData_db allData_db = new AllData_db();

            daysHistoryActivity.SetContent((Convert.ToInt32(allData_db.GetDayWorkingApplication()) + 1).ToString().Replace("-", string.Empty));
        }
コード例 #6
0
 public ActivityUser()
 {
     prewCoordinates = new Point(0, 0);
     allData_db      = new AllData_db();
 }
コード例 #7
0
 public DailyUseOfApplication_db()
 {
     activeWindow = new ActiveWindow();
     command      = new SqlCommand();
     allData_db   = new AllData_db();
 }