Ejemplo n.º 1
0
    public void OnClick_AddAssignment()
    {
        error = false;

        addAssignmentDate = assignmentSubDropMenu.setDate;

        TaskManager.Subject chosenSubj = new TaskManager.Subject();

        foreach (TaskManager.Subject eachSubject in taskManager.subjects)
        {
            if (eachSubject.subjectName == addAssignmentChosenSubj.text)
            {
                chosenSubj = eachSubject;
                break;
            }
        }

        if (chosenSubj.subjectName == "" || chosenSubj.subjectName == null)
        {
            Error("Add subjects first before creating tasks.");
        }

        if (addAssignmentName.text == "")
        {
            Error("Please give this task a heading.");
        }


        if (!error)
        {
            int partsConvert = 0;
            if (addAssignmentParts.text == "" || Convert.ToInt32(addAssignmentParts.text) == 0)
            {
                partsConvert = 100;
            }
            else
            {
                partsConvert = Convert.ToInt32(addAssignmentParts.text);
            }

            taskManager.AddAssignment(addAssignmentName.text, addAssignmentDesc.text, chosenSubj, addAssignmentDate, partsConvert);
            taskManager.HideAllPages();
            toastIndicator.ActivateToast("Added assignment task:\n" + addAssignmentName.text, grey);
            //AndroidNativePopups.OpenToast("Added Assignment Task: " + addHomeworkName.text, AndroidNativePopups.ToastDuration.Long);
        }

        if (!error)
        {
            GeneralFunctions();
        }
    }
Ejemplo n.º 2
0
    public void OnClick_AddMarks()
    {
        error = false;

        TaskManager.Subject chosenSubj = new TaskManager.Subject();

        foreach (TaskManager.Subject eachSubject in taskManager.subjects)
        {
            if (eachSubject.subjectName == addMarksChosenSubj.text)
            {
                chosenSubj = eachSubject;
                break;
            }
        }

        if (chosenSubj.subjectName == "" || chosenSubj.subjectName == null)
        {
            Error("Add subjects first before adding marks.");
        }

        if (addMarksTitle.text == "")
        {
            Error("Please give this mark a title.");
        }

        if (addMarksMark.text == "")
        {
            Error("Please add a mark for this assessment.");
        }

        if (addMarksValue.text == "")
        {
            Error("Please add a value for this assessment.");
        }

        if (!error)
        {
            marksManager.AddMark(addMarksTitle.text, addMarksChosenSubj.text, Convert.ToInt32(addMarksMark.text), Convert.ToInt32(addMarksValue.text));
            taskManager.HideAllPages();
            toastIndicator.ActivateToast("Added mark for " + addMarksChosenSubj.text, grey);
        }

        if (!error)
        {
            MarksFunctions();
        }
    }
Ejemplo n.º 3
0
    public void OnClick_SaveEditedTaskAT()
    {
        error = false;

        TaskManager.Subject chosenSubj = new TaskManager.Subject();

        foreach (TaskManager.Subject eachSubject in taskManager.subjects)
        {
            if (eachSubject.subjectName == editAssignmentChosenSubj.text)
            {
                chosenSubj = eachSubject;
                break;
            }
        }

        if (chosenSubj.subjectName == "" || chosenSubj.subjectName == null)
        {
            Error("Add subjects first before creating tasks.");
        }

        if (editAssignmentName.text == "")
        {
            Error("Please give this assignment a heading.");
        }

        if (!error)
        {
            for (int i = 0; i <= taskManager.assignmentTasks.Count; i++)
            {
                if (taskManager.assignmentTasks[i].ID == taskIDEditAT)
                {
                    //Do some shit to find real index in homework list of item
                    taskManager.EditAssignment(editAssignmentName.text, editAssignmentDesc.text, chosenSubj, editAssignmentSubDropMenu.setDate, i);
                    taskManager.HideAllPages();
                    toastIndicator.ActivateToast("Edited assignment task:\n" + editAssignmentName.text, grey);
                    break;
                }
            }
        }

        if (!error)
        {
            GeneralFunctions();
        }
    }
Ejemplo n.º 4
0
    public void OnClick_AddHomework()
    {
        error = false;

        addHomeworkDate = homeworkSubDropMenu.setDate;

        TaskManager.Subject chosenSubj = new TaskManager.Subject();

        foreach (TaskManager.Subject eachSubject in taskManager.subjects)
        {
            if (eachSubject.subjectName == addHomeworkChosenSubj.text)
            {
                chosenSubj = eachSubject;
                break;
            }
        }

        if (chosenSubj.subjectName == "" || chosenSubj.subjectName == null)
        {
            Error("Add subjects first before creating tasks.");
        }

        if (addHomeworkName.text == "")
        {
            Error("Please give this task a heading.");
        }


        if (!error)
        {
            taskManager.AddHomework(addHomeworkName.text, addHomeworkDesc.text, chosenSubj, addHomeworkDate);
            taskManager.HideAllPages();
            toastIndicator.ActivateToast("Added Homework Task:\n" + addHomeworkName.text, grey);
            //AndroidNativePopups.OpenToast("Added Homework Task: " + addHomeworkName.text, AndroidNativePopups.ToastDuration.Long);
        }

        if (!error)
        {
            GeneralFunctions();
        }
    }
Ejemplo n.º 5
0
    public void OnClick_AddRevision()
    {
        error = false;

        TaskManager.Subject chosenSubj = new TaskManager.Subject();

        foreach (TaskManager.Subject eachSubject in taskManager.subjects)
        {
            if (eachSubject.subjectName == addRevisionChosenSubj.text)
            {
                chosenSubj = eachSubject;
                break;
            }
        }

        if (chosenSubj.subjectName == "" || chosenSubj.subjectName == null)
        {
            Error("Add subjects first before assigning tasks.");
        }

        // > Description should be optional
        //   if (addRevisionText.text == "")
        //       Error("No Text Provided");

        if (!error)
        {
            string mainTextString = "<b><i>" + addRevisionTypeText.text + ": </i></b>" + addRevisionText.text;
            string extraString;

            //If no text, no colon
            if (addRevisionText.text == "")
            {
                extraString = "</i></b></color>";
            }
            else
            {
                extraString = ": </i></b></color>";
            }

            switch (addRevisionTypeText.text)
            {
            case "Revise":
                mainTextString = "<color=black><b><i>" + addRevisionTypeText.text + extraString + addRevisionText.text;
                break;

            case "Update Notes":
                mainTextString = "<color=navy><b><i>" + addRevisionTypeText.text + extraString + addRevisionText.text;
                break;

            case "Ongoing Task":
                mainTextString = "<color=grey><b><i>" + addRevisionTypeText.text + extraString + addRevisionText.text;
                break;
            }

            taskManager.AddRevision(mainTextString, chosenSubj);
            taskManager.HideAllPages();
            toastIndicator.ActivateToast("Added study task for " + chosenSubj.subjectName, grey);
            //AndroidNativePopups.OpenToast("Added Study Task for" + chosenSubj.subjectName, AndroidNativePopups.ToastDuration.Long);
        }

        if (!error)
        {
            GeneralFunctions();
        }
    }