//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(); }
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(); }
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(); } }
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(); }
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(); }
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(); }
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(); }
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; } }