private void add_click(object sender, RoutedEventArgs e) //adds the assignments to the list and the listview
        {
            Builder build = new Info_Builder();

            if (Assigntitle.Text == "" || Classbox.Text == "")
            {
                MessageBox.Show("Assignment title and course selection needed.");
                return;
            }

            if (monthbox.Text == "" || daybox.Text == "" || yearbox.Text == "")
            {
                monthbox.Text = "-";
                daybox.Text   = "-";
                yearbox.Text  = "-";
            }

            string date = monthbox.Text + "/" + daybox.Text + "/" + yearbox.Text;

            Assignment homework = build.Assignment_build(Assigntitle.Text, Classbox.Text, date, notes.Text);

            Classbox.Text    = "";
            Assigntitle.Text = "";
            daybox.Text      = "";
            monthbox.Text    = "";
            yearbox.Text     = "";
            notes.Text       = "";

            viewAssignmentList.Items.Add(homework);
            MyAssignments.Add(homework);
            addassign.Content = "Add Assignment";
        }
Beispiel #2
0
        public void addclass_Click(object sender, RoutedEventArgs e) //reads what the user has typed into the textboxes and saves them to the list while adding them to the listview
        {
            Builder build = new Info_Builder();

            if (className.Text == "" || profName.Text == "")
            {
                MessageBox.Show("Required field left blank.");
                return;
            }

            if (profEmail.Text == "")
            {
                profEmail.Text = "-";
            }

            if (HourBox.Text == "")
            {
                HourBox.Text   = "-";
                MinuteBox.Text = "--";
            }
            else if (MinuteBox.Text == "")
            {
                MinuteBox.Text = "00";
            }

            string time = HourBox.Text + ":" + MinuteBox.Text + " " + TimeBox.Text;
            string days = "";

            if (Monday.IsChecked ?? false)
            {
                days += "M ";
            }
            if (Tuesday.IsChecked ?? false)
            {
                days += "T ";
            }
            if (Wednesday.IsChecked ?? false)
            {
                days += "W ";
            }
            if (Thursday.IsChecked ?? false)
            {
                days += "R ";
            }
            if (Friday.IsChecked ?? false)
            {
                days += "F ";
            }

            Classinfo course = build.Class_build(className.Text, profName.Text, profEmail.Text, time, days);

            viewClassList.Items.Add(course);
            MyClasses.Add(course);

            className.Text      = "";
            profName.Text       = "";
            profEmail.Text      = "";
            HourBox.Text        = "";
            MinuteBox.Text      = "";
            TimeBox.Text        = "";
            addclass.Content    = "Add Class";
            Monday.IsChecked    = false;
            Tuesday.IsChecked   = false;
            Wednesday.IsChecked = false;
            Thursday.IsChecked  = false;
            Friday.IsChecked    = false;
        }