示例#1
0
        /****************************************************************************************************************************
        * @fn FinalFunction()
        * The final function changes the grade screen to say that it grades the month, as well as to put out the grade for the month.
        * Finally the function deletetes the contents of database
        ****************************************************************************************************************************/
        public void FinalFunction()
        {
            GradeWindow gradeWindow = new GradeWindow();

            gradeWindow.gradeMessage.Content = "Your grade for this month is";
            gradeWindow.gradeTest.Content    = "" + GradeMonth();
            gradeWindow.Show();
            Deleter();
        }
示例#2
0
        /*************************************************************************************************************************************************
        * @fn gradeButton_Click(object sender, RoutedEventArgs e)
        * This function finishes the whole work of the program by displaying the final grade.
        * Firstly, it checks whether or not the added index of task and grade variable goes out of scope of the grades array.
        * After the check is completed and the orrect grade is assigned, the function creates and new window to display the grade.
        * Afterwards it tests which month is it, and then checks whether or not its the final ay of said month.
        * Finally if it's the case the FinalFunction activates calculating the grade for the month, after which said grade is displayed in a new window.
        *************************************************************************************************************************************************/
        public void gradeButton_Click(object sender, RoutedEventArgs e)
        {
            if (tryTask)
            {
                if ((grade + task) > 6)
                {
                    inputBox.Text = "" + grades[6];
                }
                else
                {
                    inputBox.Text = "" + grades[grade + task];
                }
                GradeWindow gradeWindow = new GradeWindow();
                /**the variable below corresponds to the grade window, and is supplied with the grade from the main window*/
                gradeWindow.gradeTest.Content = inputBox.Text;
                gradeWindow.Show();
                GradesDatabase GradesDB = new GradesDatabase()
                {
                    /**The database is updated with the current grade*/
                    Grades = grades[grade]
                };

                using (SQLiteConnection connection = new SQLiteConnection(App.databasePath))
                {
                    connection.CreateTable <GradesDatabase>();
                    connection.Insert(GradesDB);


                    /**********************************************************************************************************************************
                    * the month switch tests which month it currently is, then checks whether it's the end of the month for said month,
                    * until finally it exceutes a query that sums up the grades from all the dates of the month and devides them by the number of days,
                    * ending with the final grade for the entire month
                    **********************************************************************************************************************************/
                    switch (month)
                    {
                    case 1:
                    {
                        if (day == 31)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 2:
                    {
                        if (day == 29)
                        {
                            FinalFunction();
                        }
                        else if (day == 28)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 3:
                    {
                        if (day == 31)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 4:
                    {
                        if (day == 30)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 5:
                    {
                        if (day == 31)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 6:
                    {
                        if (day == 30)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 7:
                    {
                        if (day == 31)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 8:
                    {
                        if (day == 31)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 9:
                    {
                        if (day == 30)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 10:
                    {
                        if (day == 31)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 11:
                    {
                        if (day == 30)
                        {
                            FinalFunction();
                        }
                        break;
                    }

                    case 12:
                    {
                        if (day == 31)
                        {
                            FinalFunction();
                        }
                        break;
                    }
                    }

                    Close();
                }
            }
        }