コード例 #1
0
        public Classwork(string name, string cl, DateTime dueDate, int priority, Guid gradeID, bool autoIncrement, int autoIncrementDays, ClassworkType type, DateTime notificationTime, Guid CWID)
        {
            this.Name              = name;
            this.Completed         = false;
            this.Cl                = cl;
            this.DueDate           = dueDate;
            this.Priority          = priority;
            this.GradeID           = gradeID;
            this.AutoIncrement     = autoIncrement;
            this.AutoIncrementDays = autoIncrementDays;
            this.Type              = type;
            this.NotificationTime  = notificationTime;
            this.CWID              = CWID;
            this.ShownNotification = false;

            this.Completed = false;

            JsonSerializerOptions options = new JsonSerializerOptions()
            {
                IncludeFields = true,
            };
        }
コード例 #2
0
        private void SaveClick(object sender, RoutedEventArgs e)
        {
            Globals.cwList.DeleteClasswork(classwrk);

            string name = tbAssignmentName.Text;
            //string grade = tbGrade.Text;
            string        autoIncrementDays = tbAutoIncrementDays.Text;
            ClassworkType type = ClassworkType.Assignment;

            switch (cmbType.SelectedIndex)
            {
            case 0:
                type = ClassworkType.Assignment;
                break;

            case 1:
                type = ClassworkType.Assessment;
                break;

            case 2:
                type = ClassworkType.ExtraCredit;
                break;
            }
            int autoIncDays = 0;

            try { autoIncDays = int.Parse(tbAutoIncrementDays.Text); } catch (Exception) { }

            DateTime?notifTime = dpNoteTime.Value;
            DateTime?dueDate   = dpDueDate.Value;

            string cl;

            try
            {
                cl = ((Class)cmbClasses.SelectedItem).Name;
                if (tempGrade == null)
                {
                    tempGrade = new Grade(cl, dueDate);
                }
            }
            catch (NullReferenceException)
            {
                cl        = null;
                tempGrade = null;
            }

            Classwork tempClasswork;

            if (tempGrade != null)
            {
                tempClasswork = new Classwork(
                    name, cl, dueDate, cmbPriority.SelectedIndex + 1, tempGrade.gradeID, (bool)cbAutoIncrement.IsChecked, autoIncDays, type, notifTime);
                tempGrade.Name  = tbAssignmentName.Text;
                tempGrade.cwID  = tempClasswork.CWID;
                tempGrade.Hours = ((Class)cmbClasses.SelectedItem).CreditHours;
                Globals.gradebook.AddGrade(tempGrade);
            }
            else
            {
                tempClasswork = new Classwork(
                    name, cl, dueDate, cmbPriority.SelectedIndex + 1, Guid.Empty, (bool)cbAutoIncrement.IsChecked, autoIncDays, type, notifTime);
            }

            if ((bool)cbComplete.IsChecked)
            {
                tempClasswork.Completed = true;
            }

            createdCW = tempClasswork;
            Globals.cwList.AddClasswork(tempClasswork);

            this.Close();
        }
コード例 #3
0
        public Classwork(string name, string cl, DateTime?dueDate, int priority, Guid gradeID, bool autoIncrement, int autoIncrementDays, ClassworkType type, DateTime?notificationTime)
        {
            //Generate ID
            this.CWID = System.Guid.NewGuid();

            this.Name              = name;
            this.Completed         = false;
            this.Cl                = cl;
            this.DueDate           = dueDate;
            this.Priority          = priority;
            this.GradeID           = gradeID;
            this.AutoIncrement     = autoIncrement;
            this.AutoIncrementDays = autoIncrementDays;
            this.Type              = type;
            this.NotificationTime  = notificationTime;
            if (notificationTime == null)
            {
                this.ShownNotification = true;
            }
            else
            {
                this.ShownNotification = false;
            }

            this.Completed = false;


            JsonSerializerOptions options = new JsonSerializerOptions()
            {
                IncludeFields = true,
            };
        }