public void AddNewNode(string nodeName, string parentNodeType) { Journal journal; switch (parentNodeType) { case JsTreeNodeType.Subjects: var subject = new Subject {SubjectName = nodeName}; JournalContext.Subjects.InsertOnSubmit(subject); JournalContext.SubmitChanges(); break; case JsTreeNodeType.PupilClass: journal = new Journal {JournalName = nodeName, Year = DateTime.Now.Year}; JournalContext.Journals.InsertOnSubmit(journal); JournalContext.SubmitChanges(); break; //case JsTreeNodeType.Pupil: // journal = JournalContext.Journals.First(j => j.JournalName == parentId); // journal.Pupils.Add(new Pupil(){JournalID = journal.JournalID}); // break; case JsTreeNodeType.Default: break; } }
partial void UpdateJournal(Journal instance);
partial void DeleteJournal(Journal instance);
partial void InsertJournal(Journal instance);
private void detach_Journals(Journal entity) { this.SendPropertyChanging(); entity.Teacher = null; }
private void attach_Journals(Journal entity) { this.SendPropertyChanging(); entity.Teacher = this; }
partial void UpdateJournal(Journal instance) { ExecuteDynamicUpdate(instance); }
partial void InsertJournal(Journal instance) { if (!Journals.Contains(instance)) ExecuteDynamicInsert(instance); }