示例#1
0
        protected void btnDodajPracownika_Click(object sender, EventArgs e)
        {
            using (SampleDataContext sdc = new SampleDataContext())
            {
                Permament pr = new Permament();
                pr.Name         = "Robert";
                pr.Gender       = "Male";
                pr.AnuualSalary = 96000;

                Contract ct = new Contract();
                ct.Name        = "Marta";
                ct.HourlyPay   = 50;
                ct.HoursWorked = 160;

                sdc.Employees2.InsertOnSubmit(pr);
                sdc.Employees2.InsertOnSubmit(ct);
                sdc.SubmitChanges();
            }
        }
示例#2
0
        protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            SampleDataContext sdc = new SampleDataContext();

            sdc.Log = Response.Output;
            switch (RadioButtonList1.SelectedValue)
            {
            case "Pemanent":
                GridView1.DataSource = sdc.Employees2.OfType <Permament>().ToList();
                GridView1.DataBind();
                break;

            case "Contract":
                GridView1.DataSource = sdc.Employees2.OfType <Contract>().ToList();
                GridView1.DataBind();
                break;

            default:
                GridView1.DataSource = convertEmployeeForDisplay(sdc.Employees2.ToList());
                GridView1.DataBind();
                break;
            }
        }