Ejemplo n.º 1
0
 public void UpdateItem(Subject t)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository<Subject>();
         rep.Update(t);
     }
 }
Ejemplo n.º 2
0
 //insert on subject
 public void CreateSubject(Subject t)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository<Subject>();
         rep.Insert(t);
     }
 }
Ejemplo n.º 3
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();
            }
        }
Ejemplo n.º 4
0
 //To Add Child
 private void AddChildrenItem(Subject node, IDictionary<int, List<Subject>> source)
 {
     if (source.ContainsKey(node.SubjectID))
     {
         File.AppendAllText("G:\\abc.txt", node.SubjectID + " Mother : Null" + Environment.NewLine);
         node.children = source[node.SubjectID];
         for (int i = 0; i < node.children.Count; i++)
         {
             AddChildrenItem(node.children[i], source);
             File.AppendAllText("G:\\abc.txt", node.children[i].SubjectID + " Mother : " + node.children[i].Mother + Environment.NewLine);
         }
     }
     else
     {
         node.children = new List<Subject>();
     }
 }
Ejemplo n.º 5
0
 public void UpdateSubject(Subject t)
 {
     subjectcntr.UpdateItem(t);
 }
Ejemplo n.º 6
0
 public void CreateSubject(Subject t)
 {
     subjectcntr.CreateSubject(t);
 }