Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MSOPSClassesDataContext dc = new MSOPSClassesDataContext();

        GridView1.DataSource = dc.GetTable <Customer>();
        GridView1.DataBind();
    }
Ejemplo n.º 2
0
    protected void btnModifyRegion_Click(object sender, EventArgs e)
    {
        try
        {
            MSOPSClassesDataContext msops_dc = new MSOPSClassesDataContext();
            Region ModRegion = msops_dc.GetTable<Region>().Single(r => r.RegionID == txtRegionID.Text);
            ModRegion.RegionID = txtRegionID.Text;
            ModRegion.RegionDesc = txtRegionDesc.Text;
            msops_dc.SubmitChanges();
            lblMessage.Text = "Region Modified";
            ClearText();

        }
        catch (Exception exp)
        {

            lblMessage.Text = "Error : " + exp.Message;
        }
    }
Ejemplo n.º 3
0
    protected void btnAddRegion_Click(object sender, EventArgs e)
    {
        try 
	    {	        
		    MSOPSClassesDataContext msops_dc = new MSOPSClassesDataContext();
            Table<Region> tblRegions = msops_dc.GetTable<Region>();
            Region newRegion= new Region {RegionID=txtRegionID.Text, RegionDesc=txtRegionDesc.Text};
            tblRegions.InsertOnSubmit(newRegion);
            msops_dc.SubmitChanges();
            lblMessage.Text="Region Created";
            ClearText();
        
	    }
	    catch (Exception exp)
    	{
		
	    	lblMessage.Text="Error : " + exp.Message;
	    }
    }