Ejemplo n.º 1
0
        protected void EmployeeTable_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string SSN = ((Label)EmployeeTable.Rows[e.RowIndex].Cells[1].FindControl("Label1")).Text;

            client.RemoveEmployee(SSN);
            EmployeeTable.DataSource = client.GetAllEmployees();
            EmployeeTable.DataBind();
        }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         EmployeeTable.DataSource = client.GetAllEmployees();
         EmployeeTable.DataBind();
         DepartmentTable.DataSource = client.GetAllDepartments();
         DepartmentTable.DataBind();
     }
 }
Ejemplo n.º 3
0
        protected void Add_Emp(object sender, EventArgs e)
        {
            string SSN = ((Label)EmployeeTable.FooterRow.Cells[1].FindControl("Label1")).Text;

            ProjRef.Employee temp_emp = new ProjRef.Employee
            {
                SSN        = int.Parse(SSN),
                Name       = ((TextBox)EmployeeTable.FooterRow.Cells[2].FindControl("TextBox2")).Text,
                Salary     = decimal.Parse(((TextBox)EmployeeTable.FooterRow.Cells[3].FindControl("TextBox4")).Text),
                Phone      = ((TextBox)EmployeeTable.FooterRow.Cells[4].FindControl("TextBox3")).Text,
                Department = int.Parse(((DropDownList)EmployeeTable.FooterRow.Cells[5].FindControl("DropDownList1")).SelectedValue)
            };
            client.AddEmployee(temp_emp);
            EmployeeTable.DataSource = client.GetAllEmployees();
            EmployeeTable.DataBind();
        }
Ejemplo n.º 4
0
        protected void EmployeeTable_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string SSN = ((Label)EmployeeTable.Rows[e.RowIndex].Cells[1].FindControl("Label1")).Text;

            ProjRef.Employee temp_emp = new ProjRef.Employee
            {
                SSN        = int.Parse(SSN),
                Name       = ((TextBox)EmployeeTable.Rows[e.RowIndex].Cells[2].FindControl("TextBox2")).Text,
                Salary     = decimal.Parse(((TextBox)EmployeeTable.Rows[e.RowIndex].Cells[3].FindControl("TextBox4")).Text),
                Phone      = ((TextBox)EmployeeTable.Rows[e.RowIndex].Cells[4].FindControl("TextBox3")).Text,
                Department = int.Parse(((DropDownList)EmployeeTable.Rows[e.RowIndex].Cells[5].FindControl("DropDownList1")).SelectedValue)
            };
            client.UpdateEmployee(temp_emp, SSN);
            EmployeeTable.EditIndex  = -1;
            EmployeeTable.DataSource = client.GetAllEmployees();
            EmployeeTable.DataBind();
        }
Ejemplo n.º 5
0
 protected void EmployeeTable_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     EmployeeTable.EditIndex  = -1;
     EmployeeTable.DataSource = client.GetAllEmployees();
     EmployeeTable.DataBind();
 }
Ejemplo n.º 6
0
 protected void EmployeeTable_RowEditing(object sender, GridViewEditEventArgs e)
 {
     EmployeeTable.EditIndex  = e.NewEditIndex;
     EmployeeTable.DataSource = client.GetAllEmployees();
     EmployeeTable.DataBind();
 }