Ejemplo n.º 1
0
    //protected void btnCall_Click(object sender, EventArgs e)
    //{
    //    EmpServiceClient proxy = new EmpServiceClient();
    //    string msg = proxy.GetMsg();
    //    lblMsg.Text = "WCF Messsage:" + msg;
    //}

    //protected void btn_tcp_Click(object sender, EventArgs e)
    //{
    //    EmpServiceClient proxy = new EmpServiceClient();
    //    string msg = proxy.GetMsg();
    //    lblMsg.Text = "WCF Messsage:" + msg;
    //}

    protected void btnGetAllEmps_Click(object sender, EventArgs e)
    {
        EmpServiceClient proxy = new EmpServiceClient("BasicHttpBinding_IEmpService");
        var result             = proxy.GetAllEmps().ToList();

        GridView1.DataSource = result;
        GridView1.DataBind();
    }
Ejemplo n.º 2
0
    protected void btndelete_Click(object sender, EventArgs e)
    {
        EmpServiceClient proxy = new EmpServiceClient("BasicHttpBinding_IEmpService");
        var Ecode = int.Parse(txtecode.Text);

        proxy.DeleteEmp(Ecode);
        GridView1.DataSource = proxy.GetAllEmps().ToList();
        GridView1.DataBind();
    }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                EmpServiceClient proxy = new EmpServiceClient();
                var empLst             = proxy.GetAllEmps().ToList();

                GridView1.DataSource = empLst;
                GridView1.DataBind();
            }
        }
Ejemplo n.º 4
0
    protected void btnemployeebyid_Click(object sender, EventArgs e)
    {
        EmpServiceClient proxy = new EmpServiceClient("BasicHttpBinding_IEmpService");
        var Ecode = int.Parse(txtecode.Text);
        var a     = proxy.GetEmpById(Ecode);

        txtename.Text        = a.Ename.ToString();
        txtsalary.Text       = a.salary.ToString();
        txtdeptid.Text       = a.deptid.ToString();
        GridView1.DataSource = proxy.GetAllEmps().ToList();
        GridView1.DataBind();
    }
Ejemplo n.º 5
0
    protected void btnupdate_Click(object sender, EventArgs e)
    {
        EmpServiceClient proxy = new EmpServiceClient("BasicHttpBinding_IEmpService");
        var result             = new tbl_employee
        {
            Ecode  = int.Parse(txtecode.Text),
            salary = int.Parse(txtsalary.Text)
        };

        proxy.UpdateEmp(result);
        GridView1.DataSource = proxy.GetAllEmps().ToList();
        GridView1.DataBind();
    }
Ejemplo n.º 6
0
    protected void btninsert_Click(object sender, EventArgs e)
    {
        EmpServiceClient proxy = new EmpServiceClient("BasicHttpBinding_IEmpService");

        var result = new tbl_employee
        {
            Ecode  = int.Parse(txtecode.Text),
            Ename  = txtename.Text,
            salary = int.Parse(txtsalary.Text),
            deptid = int.Parse(txtdeptid.Text)
        };

        proxy.AddEmployee(result);
        GridView1.DataSource = proxy.GetAllEmps().ToList();
        GridView1.DataBind();
    }
Ejemplo n.º 7
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            Employee emp = new Employee
            {
                Ecode  = int.Parse(txtEcode.Text),
                Ename  = TxtEname.Text,
                Salary = int.Parse(txtSalary.Text),
                Deptid = int.Parse(txtDeptid.Text)
            };

            EmpServiceClient proxy = new EmpServiceClient();

            proxy.UpdateEmpById(emp);
            lblMsg.Text = "Record updated";

            GridView1.DataSource = proxy.GetAllEmps().ToList();
            GridView1.DataBind();
        }
Ejemplo n.º 8
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                int ecode = int.Parse(txtEcode.Text);

                EmpServiceClient proxy = new EmpServiceClient();
                proxy.DeleteEmpById(ecode);
                lblMsg.Text = "Record deleted";

                GridView1.DataSource = proxy.GetAllEmps().ToList();
                GridView1.DataBind();
            }
            catch (FaultException <MyException> ex)
            {
                lblMsg.Text = ex.Message;
            }
        }