private void Window_Loaded(object sender, RoutedEventArgs e) { broadcastEntities = new wpfBroadcast.BroadcastEntities(); // 將資料載入 tblUser。您可以依需要修改這個程式碼。 System.Windows.Data.CollectionViewSource tblUserViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("tblUserViewSource"))); System.Data.Objects.ObjectQuery<wpfBroadcast.tblUser> tblUserQuery = this.GettblUserQuery(broadcastEntities); tblUserViewSource.Source = tblUserQuery.Execute(System.Data.Objects.MergeOption.AppendOnly); tblUserViewSource.View.CollectionChanged += View_CollectionChanged; }
//private System.Data.Entity.Infrastructure.Db<tblRecordSound> GettblRecordSoundQuery(BroadcastEntities broadcastEntities) //{ // System.Data.Objects.ObjectSet<wpfBroadcast.tblRecordSound> tblRecordSoundQuery = broadcastEntities.tblRecordSound; // // 更新查詢以將 tblSchedule 資料包含在 tblRecordSound 中。您可以依需要修改這個程式碼。 // tblRecordSoundQuery = tblRecordSoundQuery.Include("tblSchedule"); // // 傳回 ObjectQuery。 // return tblRecordSoundQuery; //} private void Window_Loaded(object sender, RoutedEventArgs e) { broadcastEntities = new wpfBroadcast.BroadcastEntities(); // 將資料載入 tblRecordSound。您可以依需要修改這個程式碼。 //System.Windows.Data.CollectionViewSource tblRecordSoundViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("tblRecordSoundViewSource"))); //System.Data.Objects.ObjectSet<wpfBroadcast.tblRecordSound> tblRecordSoundQuery = this.GettblRecordSoundQuery(broadcastEntities); //tblRecordSoundViewSource.Source = tblRecordSoundQuery.Execute(System.Data.Objects.MergeOption.AppendOnly); // 將資料載入 tblSchedule。您可以依需要修改這個程式碼。 System.Windows.Data.CollectionViewSource tblScheduleViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("tblScheduleViewSource"))); System.Data.Objects.ObjectSet<wpfBroadcast.tblSchedule> tblScheduleQuery = this.GettblScheduleQuery(broadcastEntities); tblScheduleViewSource.Source = tblScheduleQuery.Execute(System.Data.Objects.MergeOption.AppendOnly); }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.accdMenu.SelectAll(); db = new BroadcastEntities(); this.Title = db.tblApplication.FirstOrDefault().ApplicationName; tblSysLog log = new tblSysLog() { Message = "系統登入", SITE_ID = 0, Type = "S", StartTimeStamp = DateTime.Now ,UserID=App.loginUser.UserID}; db.tblSysLog.AddObject(log); db.SaveChanges(); wpfBroadcast.BroadcastEntities broadcastEntities = new wpfBroadcast.BroadcastEntities(); // 將資料載入 tblSIte。您可以依需要修改這個程式碼。 System.Windows.Data.CollectionViewSource tblSIteViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("tblSIteViewSource"))); System.Data.Objects.ObjectSet<wpfBroadcast.tblSIte> tblSIteQuery = this.GettblSIteQuery(App.db); tblSIteViewSource.Source = tblSIteQuery.Execute(System.Data.Objects.MergeOption.AppendOnly); }