Example #1
0
File: Form1.cs Project: akapet/MCPD
 private void lazyLoadingToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MessageBox.Show("Don't forget to set the Lazy Loading Enabled " + " property on the EDMX file to true!");
     var db = new NorthwindEntities();
     var order = db.Orders.Where(o => o.CustomerID == "ALFKI").First();
     gv.DataSource = order.Order_Details.ToList();
 }
Example #2
0
File: Form1.cs Project: akapet/MCPD
 private void orderDetailsWoCustomMethodToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var db = new NorthwindEntities();
     gv.DataSource = (from od in db.Order_Details.AsEnumerable()
     where od.Order.CustomerID == "ALFKI"
     select new
     {
         od.OrderID,
         od.ProductID,
         od.Quantity,
         od.Discount,
         DetailTotal = (1 - (decimal)od.Discount) * (od.Quantity * od.UnitPrice)
     }).ToList();
 }
Example #3
0
File: Form1.cs Project: akapet/MCPD
        private void stToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var d = new NorthwindEntities();
            Customer c = null;
            c.StartTracking();
            c.StopTracking();

            var db = new NorthwindEntities();
            gv.DataSource = (from c in db.Customers
                             select new
                             {
                                 c.CustomerID,
                                 c.CompanyName
                             }).ToList();

            //Customer c2 = from c in db.Customers select new {c.CustomerID == ""};

            //label1.Text = "Object State Entry: " + db.ObjectStateManager.GetObjectStateEntry(EntityKey.NoEntitySetKey);
        }
Example #4
0
File: Form1.cs Project: akapet/MCPD
 private void executeStoredProcedureToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var db = new NorthwindEntities();
     gv.DataSource = db.CustOrderHist("ALFKI");
 }