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]));
        }
Пример #2
0
 private void SetStrokeAndToolTip(MyRectangle rectangle, List <Activity> activity, int index)
 {
     rectangle.SetStroke(Color.FromArgb(100, 255, 255, 255));
     rectangle.ToolTip(activity[index].Name + " - [" + ActionOnTime.GetTimeAndDays(activity[index].ActivityTime) + " / "
                       + ActionOnTime.GetTimeAndDays(activity.Where(x => x.Name == activity[index].Name).Sum(x => x.ActivityTime)) + "] [" +
                       ActionOnNumbers.DivisionI(activity[index].ActivityTime * 100, activity.Where(x => x.Date == activity[index].Date).Sum(x => x.ActivityTime))
                       + "% / " + ActionOnNumbers.DivisionI(activity.Where(x => x.Name == activity[index].Name).Sum(x => x.ActivityTime) * 100, activity.Sum(x => x.ActivityTime)) + "%]");
 }
Пример #3
0
        private void SetStrokeAndToolTip(MyRectangle rectangle, List <ActiveApplication> activeApplication, int index)
        {
            Dictionary <string, string> nameActivity = NameActivity_db.GetAllNameActivityDictionary();

            rectangle.SetStroke(Color.FromArgb(100, 255, 255, 255));
            rectangle.ToolTip(activeApplication[index].Title + " \nAktywność [ " + nameActivity[activeApplication[index].IdNameActivity.ToString()] + " ][" + ActionOnTime.GetTimeAndDays(activeApplication[index].ActivityTime) + " / "
                              + ActionOnTime.GetTimeAndDays(activeApplication.Where(x => x.Title == activeApplication[index].Title).Sum(x => x.ActivityTime)) + "] [" +
                              ActionOnNumbers.DivisionI(activeApplication[index].ActivityTime * 100, activeApplication.Where(x => x.Date == activeApplication[index].Date).Sum(x => x.ActivityTime))
                              + "% / " + ActionOnNumbers.DivisionI(activeApplication.Where(x => x.Title == activeApplication[index].Title).Sum(x => x.ActivityTime) * 100, activeApplication.Sum(x => x.ActivityTime)) + "%]");
        }
Пример #4
0
        private void DrawDateLabel(string content, int lenghtLabelDate, int positionXLabelDate, List <ActiveApplication> otherActivity, ref int numberDateLabel)
        {
            int     tempNumberDateLabel = numberDateLabel;
            MyLabel l2 = new MyLabel(chartContentCanvas, content, lenghtLabelDate, 22, 9, positionXLabelDate, 326, Color.FromArgb(255, 255, 255, 255), Color.FromArgb(255, 255, 255, 255), 1);

            l2.SetBackgroundColor(Color.FromArgb(60, 255, 255, 255));
            string toolTip = "Wyłączony komputer [" + ActionOnTime.GetTimeAndDays(otherActivity[numberDateLabel].ActivityTime) + " / " + ActionOnTime.GetTimeAndDays(otherActivity.Where(x => x.ID == 1).Sum(x => x.ActivityTime)) + "] [" +
                             ActionOnNumbers.DivisionI(otherActivity[numberDateLabel].ActivityTime * 100, otherActivity.Where(x => x.Date == otherActivity[tempNumberDateLabel].Date).Sum(x => x.ActivityTime))
                             + "% / " + ActionOnNumbers.DivisionI(otherActivity.Where(x => x.ID == 1).Sum(x => x.ActivityTime) * 100, otherActivity.Sum(x => x.ActivityTime)) + "%]"
                             + "\nBrak aktywności [" + ActionOnTime.GetTimeAndDays(otherActivity[++numberDateLabel].ActivityTime) + "/ " + ActionOnTime.GetTimeAndDays(otherActivity.Where(x => x.ID == 2).Sum(x => x.ActivityTime)) + "] [" +
                             ActionOnNumbers.DivisionI(otherActivity[numberDateLabel].ActivityTime * 100, otherActivity.Where(x => x.Date == otherActivity[tempNumberDateLabel].Date).Sum(x => x.ActivityTime))
                             + "% / " + ActionOnNumbers.DivisionI(otherActivity.Where(x => x.ID == 2).Sum(x => x.ActivityTime) * 100, otherActivity.Sum(x => x.ActivityTime)) + "%]";

            l2.ToolTip(toolTip);
            numberDateLabel++;
        }
        private void LoadNonTitleApplication()
        {
            Dictionary <string, string> idNonActiveWindow = NonActiveWindow_db.GetIDNonActiveWindow();

            nonTitleApplicationCanvas.Children.Clear();
            nonTitleApplicationCanvas.Height = 286;
            int nextIndex = 0;

            foreach (KeyValuePair <string, string> name in idNonActiveWindow)
            {
                Label application = ButtonCreator.CreateButton(nonTitleApplicationCanvas,
                                                               (nextIndex + 1) + "." + "\t" + name.Value.Remove(10) + "\t" + ActionOnTime.GetTimeAndDays(Convert.ToInt32(NonActiveWindow_db.GetTimeNonActiveWindow(name.Key))),
                                                               250, 29, 11, 20, 0 + (nextIndex * 32), Color.FromArgb(255, 255, 255, 255), Color.FromArgb(255, 155, 155, 155), horizontalAlignment: HorizontalAlignment.Left);
                application.Background           = new SolidColorBrush(Color.FromArgb((byte)(50 + (nextIndex % 2 * 30)), 0, 125, 255));
                application.Name                 = "ID_" + name.Key;
                application.MouseEnter          += buttonContent_MouseEnter;
                application.MouseLeave          += buttonContent_MouseLeave;
                application.MouseLeftButtonDown += selectNonTitleApplication_MouseLeftButtonDown;

                Label deleteButton = ButtonCreator.CreateButton(nonTitleApplicationCanvas, "X", 22, 22, 8, 244, 3 + (nextIndex * 32),
                                                                Color.FromArgb(255, 255, 255, 255), Color.FromArgb(255, 155, 155, 155), 1);
                deleteButton.Background           = new SolidColorBrush(Color.FromArgb(100, 250, 0, 0));
                deleteButton.Name                 = "ID_" + name.Key;
                deleteButton.MouseEnter          += deleteButton_MouseEnter;
                deleteButton.MouseLeave          += deleteButton_MouseLeave;
                deleteButton.MouseLeftButtonDown += deleteButton_MouseLeftButtonDown;

                nonTitleApplicationCanvas.Height += 32;
                nextIndex++;
            }
            nonTitleApplicationCanvas.Height = ((nonTitleApplicationCanvas.Height - 286) < 286) ? 286 : nonTitleApplicationCanvas.Height - 285;
            idAddNewTitleApplication         = 0;
        }