Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            FourthCoffeeEntities db = new FourthCoffeeEntities(new Uri("http://localhost:59620/FourthCoffeeDataService.svc"));
            var r = from a in db.Employees
                    select a;

            foreach (Employees ee in r)
            {
                listBox1.Items.Add(ee.EmployeeID + "\t" + ee.FirstName);
            }
        }
Esempio n. 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            FourthCoffeeEntities db = new FourthCoffeeEntities(new Uri("http://localhost:59620/FourthCoffeeDataService.svc"));
            Employees            ee = new Employees();

            ee.FirstName  = "hog";
            ee.LastName   = "hog";
            ee.EmployeeID = 99;
            db.AddToEmployees(ee);
            db.SaveChanges();
            button1.PerformClick();
        }
Esempio n. 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();

            FourthCoffeeEntities db = new FourthCoffeeEntities(new Uri("http://localhost:59620/FourthCoffeeDataService.svc"));
            var es = db.Execute <Employees>(new Uri("http://localhost:59620/FourthCoffeeDataService.svc/EmployeesByID?id=" + textBox1.Text));

            foreach (Employees ee in es)
            {
                listBox1.Items.Add(ee.EmployeeID + "\t" + ee.FirstName);
            }
        }
        static CustomerAccountsController()
        {
            const string metaData     = "res://*/FourthCoffee.csdl|res://*/FourthCoffee.ssdl|res://*/FourthCoffee.msl";
            const string appName      = "EntityFramework";
            const string providerName = "System.Data.SqlClient";

            EntityConnectionStringBuilder efBuilder = new EntityConnectionStringBuilder();

            efBuilder.Metadata = metaData;
            efBuilder.Provider = providerName;
            efBuilder.ProviderConnectionString = Util.EncryptSecret;

            db = new FourthCoffeeEntities(efBuilder.ConnectionString);
        }