private void setWarningText()
        {
            var crn   = CourseManagementTools.findCrn(this.courseComboBox.Text, this.semesterComboBox.Text);
            var items = this.rubricDAL.GetCourseRubricByCRN(crn);
            int sum   = 0;

            foreach (var currRubricItem in items)
            {
                sum += currRubricItem.AssignmentWeight;
            }
            this.warningText.Foreground = new SolidColorBrush(Colors.Blue);
            if (sum > 100)
            {
                this.warningText.Text = "Caution: rubric values add to " + sum + " which is over 100 percent";
            }
            else if (sum < 100)
            {
                this.warningText.Text = "Caution: rubric values add to " + sum + " which is less than 100 percent";
            }
            else
            {
                this.warningText.Text       = "Rubric values sum to 100";
                this.warningText.Foreground = new SolidColorBrush(Colors.LimeGreen);
            }
        }
        /// <summary>
        ///     Loads the data grid.
        /// </summary>
        public void LoadDataGrid()
        {
            var name = this.homePage.AssignmentCombo.SelectedItem == null ? "":this.homePage.AssignmentCombo.SelectedItem.ToString();
            var crn  = CourseManagementTools.findCrn(this.homePage.CourseCombo.Text, this.homePage.semesterBox.Text);

            this.desktopGradedItemDal.populateDataGrid(crn, name, this.homePage.dataGridGrades);
            this.currentCrn = crn;
        }
        private void InsertButton_Click(object sender, RoutedEventArgs e)
        {
            var crn = CourseManagementTools.findCrn(this.courseComboBox.Text, this.semesterComboBox.Text);
            var assignmentWeightBox = Int32.Parse(this.assignmentWeightBox.Text);

            this.rubricDAL.InsertCourseRubric(this.assignmentTypeBox.Text, assignmentWeightBox, crn);
            this.refresh();
            this.setWarningText();
        }
예제 #4
0
        public void updateVisibility()
        {
            var crn = CourseManagementTools.findCrn(this.assignmentPage.courseComboBox.SelectedItem as string,
                                                    this.assignmentPage.semesterComboBox.SelectedItem as string);
            var  assignmentName = this.assignmentPage.AssignmentCombo.SelectedItem as string;
            var  isChecked      = this.assignmentPage.visibilityCheckBox.IsChecked;
            bool isPublic       = isChecked != null && (bool)isChecked;

            this.gradeItemDal.PublishGradeItemByNameAndCRNForAllStudents(crn, assignmentName, isPublic);
        }
        private void loadRubric()
        {
            var crn   = CourseManagementTools.findCrn(this.courseComboBox.Text, this.semesterComboBox.Text);
            var items = this.rubricDAL.GetCourseRubricByCRN(crn);

            foreach (var rubricItem in items)
            {
                this.rubricItems.Add(rubricItem);
            }
        }
예제 #6
0
        /// <summary>
        ///     Populates the assignment ComboBox.
        /// </summary>
        public void PopulateAssignmentComboBox()
        {
            var crn = CourseManagementTools.findCrn(this.assignmentPage.courseComboBox.SelectedItem as string,
                                                    this.assignmentPage.semesterComboBox.SelectedItem as string);
            var assignments = this.gradeItemDal.GetUniqueGradedItemsByCRN(crn);

            foreach (var name in assignments)
            {
                this.assignmentPage.AssignmentCombo.Items.Add(name.Value);
            }
        }
        private void  populateAssignmentComboBox()
        {
            var crn         = CourseManagementTools.findCrn(this.homePage.CourseCombo.Text, this.homePage.semesterBox.Text);
            var assignments = this.gradedItemDal.GetUniqueGradedItemsByCRN(crn);

            foreach (var name in assignments)
            {
                this.homePage.AssignmentCombo.Items.Add(name.Value);
            }

            this.homePage.AssignmentCombo.SelectedIndex = 0;
        }
예제 #8
0
        private void AssignmentCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            GradeItemDAL dal = new GradeItemDAL();
            var          crn = CourseManagementTools.findCrn(this.courseComboBox.Text, this.semesterComboBox.Text);

            item = dal.GetGradedItemByCRNAndGradeName(crn, this.AssignmentCombo.Text);
            if (item != null)
            {
                this.assignmentNameBox.Text = item.Name;
                this.pointsBox.Text         = item.PossiblePoints.ToString();
            }
        }
예제 #9
0
        private void populateAssignmentTypeComboBox()
        {
            var crn = CourseManagementTools.findCrn(this.assignmentPage.courseComboBox.SelectedItem as string,
                                                    this.assignmentPage.semesterComboBox.SelectedItem as string);
            var rubricItems = this.rubricDal.GetCourseRubricByCRN(crn);

            foreach (var item in rubricItems)
            {
                this.assignmentPage.assignmentTypeComboBox.Items.Add(item.AssignmentType);
            }

            this.assignmentPage.assignmentTypeComboBox.SelectedIndex = 0;
        }
예제 #10
0
        private void handleWhenGradeItemDoesNotExists()
        {
            var crn = CourseManagementTools.findCrn(this.assignmentPage.courseComboBox.SelectedItem as string,
                                                    this.assignmentPage.semesterComboBox.SelectedItem as string);
            var assignmentName = this.assignmentPage.assignmentNameBox.Text;
            var possiblePoints = Convert.ToInt32(this.assignmentPage.pointsBox.Text);
            var gradeType      = this.assignmentPage.assignmentTypeComboBox.Text;
            var isChecked      = this.assignmentPage.visibilityCheckBox.IsChecked;
            var item           = new GradeItem(assignmentName, null, 0, string.Empty, possiblePoints, gradeType, string.Empty, 0,
                                               isChecked != null && isChecked.Value, null);

            this.gradeItemDal.InsertNewGradedItemByCRNForAllStudents(item, crn);
        }
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            var crn              = CourseManagementTools.findCrn(this.courseComboBox.Text, this.semesterComboBox.Text);
            var assignmentType   = this.assignmentTypeBox.Text;
            var assignmentWeight = Int32.Parse(this.assignmentWeightBox.Text);
            var index            = this.originalItem.Index;
            var orginalCRN       = this.originalItem.CRN;

            this.rubricDAL.UpdateCourseRubric(crn, assignmentType, assignmentWeight, this.originalItem.AssignmentType, this.originalItem.AssignmentWeight, index, index, orginalCRN);
            this.refresh();
            this.setWarningText();
            this.assignmentTypeBox.Clear();
            this.assignmentWeightBox.Clear();
        }
예제 #12
0
        /// <summary>
        ///     Handles the deletion.
        /// </summary>
        public void HandleDeletion()
        {
            var crn = CourseManagementTools.findCrn(this.assignmentPage.courseComboBox.SelectedItem as string,
                                                    this.assignmentPage.semesterComboBox.SelectedItem as string);
            var value = showConfirmDialog("Delete This Item?");

            if (value != null && value == true)
            {
                if (this.selectedGradeItem != null)
                {
                    this.gradeItemDal.deleteGradedItemByCRNForAllStudents(this.selectedGradeItem, crn);
                    this.assignmentPage.AssignmentCombo.Items.Remove(this.selectedGradeItem.Name);
                    this.assignmentPage.AssignmentCombo.SelectedIndex = 0;
                }
            }
        }
예제 #13
0
        /// <summary>
        ///     Displays the grade item details.
        /// </summary>
        public void DisplayGradeItemDetails()
        {
            var crn = CourseManagementTools.findCrn(this.assignmentPage.courseComboBox.SelectedItem as string,
                                                    this.assignmentPage.semesterComboBox.SelectedItem as string);

            this.selectedGradeItem =
                this.gradeItemDal.GetGradedItemByCRNAndGradeName(crn,
                                                                 this.assignmentPage.AssignmentCombo.SelectedItem as string);
            if (this.selectedGradeItem != null)
            {
                this.assignmentPage.assignmentNameBox.Text = this.selectedGradeItem.Name;
                this.assignmentPage.pointsBox.Text         =
                    this.selectedGradeItem.PossiblePoints.ToString(CultureInfo.CurrentCulture);
                this.assignmentPage.visibilityCheckBox.IsChecked = this.selectedGradeItem.IsPublic;
            }
        }
예제 #14
0
        /// <summary>
        ///     Handles the editing.
        /// </summary>
        public void HandleEditing()
        {
            var value = showConfirmDialog("Edit This Item?");

            if (value != null && value == true)
            {
                var crn = CourseManagementTools.findCrn(this.assignmentPage.courseComboBox.SelectedItem as string,
                                                        this.assignmentPage.semesterComboBox.SelectedItem as string);
                this.selectedGradeItem.Name           = this.assignmentPage.assignmentNameBox.Text;
                this.selectedGradeItem.PossiblePoints = int.Parse(this.assignmentPage.pointsBox.Text);
                var isChecked = this.assignmentPage.visibilityCheckBox.IsChecked;
                if (isChecked != null)
                {
                    this.selectedGradeItem.IsPublic = (bool)isChecked;
                }
                this.gradeItemDal.UpdateGradeItemByCRNAndOldNameForAllStudents(this.selectedGradeItem, crn,
                                                                               this.assignmentPage.AssignmentCombo.SelectedItem as string);
                this.assignmentPage.AssignmentCombo.Items.Clear();
                this.PopulateAssignmentComboBox();
                this.assignmentPage.AssignmentCombo.SelectedIndex = 0;
            }
        }