public void LLenarDatos() { LayerBusinness.LayerBusinnessEmpleado oLB = new LayerBusinness.LayerBusinnessEmpleado(); GridView1.DataSource = oLB.CalcularSalario(); GridView1.DataBind(); }
public void LlenarDatos() { LayerBusinness.LayerBusinnessEmpleado oLB = new LayerBusinness.LayerBusinnessEmpleado(); GridView1.DataSource = oLB.MostrarEmpleado(); GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { LayerBusinness.LayerBusinnessEmpleado oLB = new LayerBusinness.LayerBusinnessEmpleado(); Int64 ID = Convert.ToInt64(GridView1.DataKeys[e.RowIndex].Value.ToString()); try { oLB.EliminarEmpleado(ID); LblMsg.Text = "Empleado Eliminado"; LlenarDatos(); } catch (Exception exc) { LblMsg.Text = exc.Message.ToString(); } finally { oLB = null; } }
// en el rayito le doy doble click en el evento que se llama rowUpdating protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { LayerBusinness.LayerBusinnessEmpleado oLB = new LayerBusinness.LayerBusinnessEmpleado(); Int64 ID = Convert.ToInt64(GridView1.DataKeys[e.RowIndex].Value.ToString()); int result = 0; GridViewRow row = GridView1.Rows[e.RowIndex]; TextBox TA = (TextBox)row.FindControl("TxtApellidos"); TextBox TN = (TextBox)row.FindControl("TxtNombres"); TextBox TH = (TextBox)row.FindControl("TxtHoras"); TextBox TS = (TextBox)row.FindControl("TxtSueldo"); try { result = oLB.EditarEmpleado(ID, TA.Text, TN.Text, Convert.ToDouble(TH.Text), Convert.ToDouble(TS.Text)); if (result > 0) { LblMsg.Text = "Empleado Editado"; } else { LblMsg.Text = "Empleado NO Editado"; } } catch (Exception exc) { LblMsg.Text = exc.Message.ToString(); } finally { oLB = null; } GridView1.EditIndex = -1; LlenarDatos(); }
protected void BtnGuardar_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } else { try { oLB.InsertarEmpleado(Convert.ToInt64(TxtId.Text), TxtApellidos.Text, TxtNombres.Text, Convert.ToDouble(TxtHoras.Text), Convert.ToDouble(TxtSueldo.Text)); LblMsg.Text = "Empleado Insertado"; } catch (Exception exc) { LblMsg.Text = exc.Message.ToString(); } finally { oLB = null; } } }