Esempio n. 1
0
 private void loadRole()
 {
     // This line of code is generated by Data Source Configuration Wizard
     // Instantiate a new DBContext
     dbContext = new COS_DesktopApp.CanteenOrderingSystemEntities();
     // Call the LoadAsync method to asynchronously get the data for the given DbSet from the database.
     dbContext.account_role.LoadAsync().ContinueWith(loadTask =>
     {
         // Bind data to control when loading complete
         account_roleBindingSource.DataSource = dbContext.account_role.Local.ToBindingList();
     }, System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext());
 }
Esempio n. 2
0
        public ucOrder()
        {
            InitializeComponent();
            // This line of code is generated by Data Source Configuration Wizard
            // Instantiate a new DBContext
            dbContext = new COS_DesktopApp.CanteenOrderingSystemEntities();
            // Call the LoadAsync method to asynchronously get the data for the given DbSet from the database.
            dbContext.orders.LoadAsync().ContinueWith(loadTask =>
            {
                this.loadOrderDetails();
                Thread.Sleep(100);

                // Bind data to control when loading complete
                ordersBindingSource.DataSource = dbContext.orders.Local.ToBindingList();
            }, System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext());
        }