private void button1_Click(object sender, RoutedEventArgs e) { // test for SGDD and it's fragment DBEngine _dbEngine = App.EngineInstance.GetDBEngine; Table_SGDD t1 = new Table_SGDD(){ ID ="1", Version = 23}; Table_SGDD_Fragment f1 = new Table_SGDD_Fragment() { FragmentID = "f1", SGDD_ID = "1" }; Table_SGDD_Fragment f2 = new Table_SGDD_Fragment() { FragmentID = "f2", SGDD_ID = "1" }; try { _dbEngine.CmtvDBContext.SGDD_items.InsertOnSubmit(t1); _dbEngine.CmtvDBContext.SGDD_Fragment_items.InsertOnSubmit(f1); _dbEngine.CmtvDBContext.SGDD_Fragment_items.InsertOnSubmit(f2); _dbEngine.CmtvDBContext.SubmitChanges(); } catch (Exception e1) { } var sgdd = (from c in _dbEngine.CmtvDBContext.SGDD_items select c).First(); var v2 = from c in _dbEngine.CmtvDBContext.SGDD_Fragment_items where c.SGDD.ID == sgdd.ID select c; //foreach (var v in v2) { _dbEngine.CmtvDBContext.SGDD_Fragment_items.DeleteAllOnSubmit(v2); } _dbEngine.CmtvDBContext.SGDD_items.DeleteOnSubmit(sgdd); _dbEngine.CmtvDBContext.SubmitChanges(); //v.FirstOrDefault() //SaveContentData(new Table_Content() { ServiceID = "4", ID = "C2", ContentName = "朝闻天下", ContentClass = "Video", StartTime = DateTime.Now, EndTime = DateTime.Now }); //SaveContentData(new Table_Content() { ServiceID = "1", ID = "C3", ContentName = "生活早参考", ContentClass = "Video", StartTime = DateTime.Now, EndTime = DateTime.Now }); //SaveContentData(new Table_Content() { ServiceID = "4", ID = "C4", ContentName = "焦点访谈:用事实说话", ContentClass = "Video", StartTime = DateTime.Now, EndTime = DateTime.Now }); //SaveContentData(new Table_Content() { ServiceID = "1", ID = "C5", ContentName = "国际艺苑", ContentClass = "Video", StartTime = DateTime.Now.AddHours(-2), EndTime = DateTime.Now }); //SaveContentData(new Table_Content() { ServiceID = "2", ID = "C6", ContentName = "焦点访谈:", ContentClass = "Video", StartTime = DateTime.Now.AddMinutes(33), EndTime = DateTime.Now.AddHours(5) }); //SaveContentData(new Table_Content() { ServiceID = "2", ID = "C7", ContentName = "说话", ContentClass = "Video", StartTime = DateTime.Now, EndTime = DateTime.Now.AddHours(1) }); //SaveContentData(new Table_Content() { ServiceID = "3", ID = "C8", ContentName = "睛彩天下", ContentClass = "Video", StartTime = DateTime.Now, EndTime = DateTime.Now.AddMinutes(13) }); }
private void Remove(Table_SGDD_Fragment a) { a.SGDD = null; }
private void Remove(Table_SGDD_Fragment a) { a.SGDD = null; }
private void Add(Table_SGDD_Fragment a) { a.SGDD = this; }
private void Add(Table_SGDD_Fragment a) { a.SGDD = this; }