示例#1
0
        private void DeleteOutcome_Click(object sender, RoutedEventArgs e)
        {
            TagData td = (TagData)this.Tag;

            if (td.IsDeletable == true)
            {
                var sp = ParentFinder.FindParent <StackPanel>(this);
                if (!td.IsNew)
                {
                    if (td.Type == OutcomeType.CourseOutcome)
                    {
                        var win = ParentFinder.FindParent <CreateCourseWindow>(this);
                        win.outcomesToDelete.Add(td.Id);
                    }
                    else if (td.Type == OutcomeType.DepartmentOutcome)
                    {
                        var win = ParentFinder.FindParent <CreateDepartmentWindow>(this);
                        win.outcomesToDelete.Add(td.Id);
                    }
                }
                if (sp != null)
                {
                    sp.Children.Remove(this);
                }
            }
        }
        private async void DeleteCourseBtn_Click(object sender, RoutedEventArgs e)
        {
            IParentWindow       parent = ParentFinder.FindParent <AdminPanelWindow>(this);
            MessageDialogResult r      = await parent.ShowMessage("Warning",
                                                                  "Are you sure you want to delete this course",
                                                                  MessageDialogStyle.AffirmativeAndNegative);

            if (r == MessageDialogResult.Negative)
            {
                return;
            }
            Button      btn   = (Button)sender;
            CourseModel model = new CourseModel();

            model = (CourseModel)btn.Tag;
            // TODO - Delete the selected department

            if (GlobalConfig.Connection.DeleteCourse_ById(model.Id))
            {
                Courses.Remove(model);
                WireUpLists();
                // TODO - Delete the selected term
            }
            else
            {
                await parent.ShowMessage("Deletion Error",
                                         "The selected course can't be deleted beacause it has an exam",
                                         MessageDialogStyle.Affirmative);

                // TODO - ADD a MessageBox
            }
        }
示例#3
0
        private async void DeleteAssignmentBtn_Click(object sender, RoutedEventArgs e)
        {
            IParentWindow       parent = ParentFinder.FindParent <AdminPanelWindow>(this);
            MessageDialogResult r      = await parent.ShowMessage("Warning",
                                                                  "Are you sure you want to delete this assginment",
                                                                  MessageDialogStyle.AffirmativeAndNegative);

            if (r == MessageDialogResult.Negative)
            {
                return;
            }

            //    // TODO - Delete the selected Assignment
            AssignmentModel model = (AssignmentModel)assignmentsGrid.SelectedItem;

            if (GlobalConfig.Connection.DeleteAssignment_ById(model.Id))
            {
                Assignments.Remove(model);
                WireUpLists(Assignments);
                // TODO - Delete the selected term
            }
            else
            {
                await parent.ShowMessage("Deletion Error",
                                         "The selected assignment can't be deleted beacause it has an exam",
                                         MessageDialogStyle.Affirmative);

                // TODO - ADD a MessageBox
            }
        }
示例#4
0
        private async void FileLink_Click(object sender, RoutedEventArgs e)
        {
            ExamModel model = (ExamModel)examsGrid.SelectedItem;

            try
            {
                System.Diagnostics.Process.Start(model.FilePath);
            }
            catch (Exception)
            {
                IParentWindow parent;
                if (MyAdmin != null)
                {
                    parent = ParentFinder.FindParent <AdminPanelWindow>(this);
                }
                else
                {
                    parent = ParentFinder.FindParent <TeacherPanelWindow>(this);
                }
                MessageDialogResult r = await parent.ShowMessage("File Not Found",
                                                                 "The requested excel file wasn't found. Do you want to create a new file?",
                                                                 MessageDialogStyle.AffirmativeAndNegative);

                if (r == MessageDialogResult.Affirmative)
                {
                    CreateExcelFile();
                }
            }
        }
示例#5
0
        private async void DeleteExamBtn_Click(object sender, RoutedEventArgs e)
        {
            IParentWindow parent;

            if (MyAdmin != null)
            {
                parent = ParentFinder.FindParent <AdminPanelWindow>(this);
            }
            else
            {
                parent = ParentFinder.FindParent <TeacherPanelWindow>(this);
            }

            MessageDialogResult r = await parent.ShowMessage("Warning",
                                                             "Are you sure you want to delete this exam",
                                                             MessageDialogStyle.AffirmativeAndNegative);

            if (r == MessageDialogResult.Negative)
            {
                return;
            }
            ExamModel model = (ExamModel)examsGrid.SelectedItem;

            GlobalConfig.Connection.DeleteExam_ById(model.Id);
            MyExams.Remove(model);
            WireUpLists(MyExams);
        }
示例#6
0
        private void DeleteStudentData_Click(object sender, RoutedEventArgs e)
        {
            var sp = ParentFinder.FindParent <StackPanel>(this);

            if (sp != null)
            {
                sp.Children.Remove(this);
            }
        }
        public override void Initialize()
        {
            var schemaFileNames = Context.Configuration.SchemaFileNames;
            var schemaDependencyFileNames = Context.Configuration.SchemaDependencyFileNames;
            var allFileNames = schemaFileNames.Union(schemaDependencyFileNames, StringComparer.OrdinalIgnoreCase);

            try
            {
                SchemaSet = XmlSchemaSetBuilder.Build(allFileNames);
            }
            catch (Exception ex)
            {
                throw ExceptionBuilder.ErrorBuildingSchemaSet(ex);
            }

            _schemaDependencyFiles = new HashSet<string>(schemaDependencyFileNames, StringComparer.OrdinalIgnoreCase);

            _objectParents = new Dictionary<XmlSchemaObject, HashSet<XmlSchemaObject>>();
            var parentFinderNew = new ParentFinder(SchemaSet, _objectParents);
            parentFinderNew.Traverse(SchemaSet);

            _typeUsages = new Dictionary<XmlSchemaType, HashSet<XmlSchemaObject>>();
            var typeUsageFinder = new TypeUsageFinder(SchemaSet, _typeUsages);
            typeUsageFinder.Traverse(SchemaSet);

            var rootSchemaFinder = new NamespaceRootSchemaFinder(_schemaDependencyFiles);
            rootSchemaFinder.Traverse(SchemaSet);
            _namespaceRootSchemas = rootSchemaFinder.GetRootSchemas();

            var rootElementFinder = new NamespaceRootElementFinder(SchemaSet);
            rootElementFinder.Traverse(SchemaSet);
            _namespaceRootElements = rootElementFinder.GetRootElements();

            RemoveDependencySchemaObjects(_namespaceRootSchemas);
            RemoveDependencySchemaObjects(_namespaceRootElements);
        }