Beispiel #1
0
        public void BindTree()
        {
            SubjectHandler sh = new SubjectHandler();

            var tree = sh.GetSubjectsAsTree();
            JavaScriptSerializer TheSerializer = new JavaScriptSerializer();
            hdnTreeData.Value = TheSerializer.Serialize(tree);
        }
Beispiel #2
0
        protected void btnAddSubject_Click(object sender, EventArgs e)
        {
            if (hdnNodeSubjectId.Value != "")
            {
                SubjectHandler h = new SubjectHandler();

                Subject SelectedSubject = h.GetSubject(Convert.ToInt32(hdnNodeSubjectId.Value));

                //Get All subjects with same mother as selected but with higher Order
                var updateSubjects = h.GetSubjectsFromMotherWhereOrderGreaterThan(SelectedSubject.Mother, SelectedSubject.SubjectOrder);
                //Increase Order by one to make room for new subject
                foreach (Subject s in updateSubjects)
                {
                    s.SubjectOrder += 1;
                    h.UpdateSubject(s);
                }

                Subject newSubject = new Subject();
                newSubject.label = txtAddSubject.Text;
                newSubject.SubjectOrder = SelectedSubject.SubjectOrder + 1;
                newSubject.Mother = SelectedSubject.Mother;
                h.CreateSubject(newSubject);

                BindTree();
            }
        }
Beispiel #3
0
        protected void btnSaveSubjects_Click(object sender, EventArgs e)
        {
            JavaScriptSerializer js = new JavaScriptSerializer();
            string json = hdnGetJosnResult.Value;
            var flatSubjects = js.Deserialize<Subject[]>(json).ToList();

            SubjectHandler sh = new SubjectHandler();

            //Todo: Finish Save
        }