예제 #1
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            LayerBussines.LayerBussinesEmpleado olB = new LayerBussines.LayerBussinesEmpleado();
            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();
        }
예제 #2
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            LayerBussines.LayerBussinesEmpleado oLb = new LayerBussines.LayerBussinesEmpleado();

            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;
            }
        }
예제 #3
0
 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;
         }
     }
 }
예제 #4
0
 public void LlenarDatos()
 {
     LayerBussines.LayerBussinesEmpleado oLb = new LayerBussines.LayerBussinesEmpleado();
     GridView1.DataSource = oLb.MostrarEmpleados();
     GridView1.DataBind();
 }
예제 #5
0
 public void LlenarDatos()
 {
     LayerBussines.LayerBussinesEmpleado oLB = new LayerBussines.LayerBussinesEmpleado();
     GridView1.DataSource = oLB.CalcularSalario();
     GridView1.DataBind();
 }