//private void crearEmpleados() //{ // List<EmpleadoEntity> listaEmpleados = (List<EmpleadoEntity>)Session["empleados"]; // if (listaEmpleados != null) // { // empleados = listaEmpleados; // } // else // { // empleados = new List<EmpleadoEntity>(); // } //} //private void cargarTipoEmpleados() //{ // TipoEmpleadoEntity jefeTi = new TipoEmpleadoEntity(); // jefeTi.Codigo = 1; // jefeTi.Nombre = "Jefe TI"; // TipoEmpleadoEntity programador = new TipoEmpleadoEntity(); // programador.Codigo = 2; // programador.Nombre = "Programador"; // TipoEmpleadoEntity cajera = new TipoEmpleadoEntity(); // cajera.Codigo = 3; // cajera.Nombre = "Cajera"; // TipoEmpleadoEntity supervisor = new TipoEmpleadoEntity(); // supervisor.Codigo = 4; // supervisor.Nombre = "Supervisor"; // tipos = new List<TipoEmpleadoEntity>(); // tipos.Add(jefeTi); // tipos.Add(programador); // tipos.Add(cajera); // tipos.Add(supervisor); // cmb_tipo_empleado.DataSource = tipos; // cmb_tipo_empleado.DataBind(); // Session["tipoEmpleados"] = tipos; //} protected void btn_registrar_Click(object sender, EventArgs e) { try { validar(); EmpleadoEntity nuevoEmpleado = new EmpleadoEntity(); nuevoEmpleado.Nombres = txt_nombres.Text; nuevoEmpleado.ApellidoPaterno = txt_apellidoPaterno.Text; nuevoEmpleado.ApellidoMaterno = txt_apellidoMaterno.Text; nuevoEmpleado.Run = txt_run.Text; TipoEmpleadoEntity tipoEmpSeleccion = tipos.FirstOrDefault( tipos => tipos.Codigo == Int32.Parse(cmb_tipo_empleado.SelectedValue)); TipoEmpleadoEntity newTipoEmp = new TipoEmpleadoEntity(); newTipoEmp.Nombre = tipoEmpSeleccion.Nombre; newTipoEmp.Codigo = tipoEmpSeleccion.Codigo; nuevoEmpleado.TipoEmpleado = newTipoEmp; nuevoEmpleado.Telefono = Int32.Parse(txt_telefono.Text); nuevoEmpleado.Remuneracion = Int32.Parse(txt_remuneracion.Text); nuevoEmpleado.FechaNacimiento = DateTime.Parse(txt_fecha_nacimiento.Text); empleadoBusiness.create(nuevoEmpleado); lbl_mensaje.Text = "Empleado registrado exitosamente."; lbl_mensaje.CssClass = "green-mesage"; } catch (Exception ex) { lbl_mensaje.Text = ex.Message; lbl_mensaje.CssClass = "red-message"; } }
protected void tbl_empleados_RowEditing(object sender, GridViewEditEventArgs e) { GridViewRow row = tbl_empleados.Rows[e.NewEditIndex]; string nombres = row.Cells[0].Text; string apePaterno = row.Cells[1].Text; string apeMaterno = row.Cells[2].Text; string run = row.Cells[3].Text; string tipoEmpleados = row.Cells[4].Text; string calle = row.Cells[5].Text; string numero = row.Cells[6].Text; string comuna = row.Cells[7].Text; string telefono = row.Cells[8].Text; string remuneracion = row.Cells[9].Text; string fechaNacimiento = row.Cells[10].Text; EmpleadoEntity actualizarEmp = new EmpleadoEntity(); actualizarEmp.Nombres = nombres; actualizarEmp.ApellidoPaterno = apePaterno; actualizarEmp.ApellidoMaterno = apeMaterno; actualizarEmp.Run = run; TipoEmpleadoEntity tipoEmp = new TipoEmpleadoEntity(); tipoEmp.Nombre = tipoEmpleados; actualizarEmp.TipoEmpleado = tipoEmp; actualizarEmp.Telefono = Int32.Parse(telefono); actualizarEmp.Remuneracion = Int32.Parse(remuneracion); actualizarEmp.FechaNacimiento = DateTime.Parse(fechaNacimiento); Session["updateEmp"] = actualizarEmp; Response.Redirect("registrar_empleado.aspx"); }
public List <TipoEmpleadoEntity> findAll() { List <TipoEmpleadoEntity> tipos = new List <TipoEmpleadoEntity>(); foreach (NUMEROUNODataSet.TIPO_EMPLEADORow row in adapter.GetData().Rows) { TipoEmpleadoEntity tipoEmpleado = new TipoEmpleadoEntity(); tipoEmpleado.Codigo = row.CODIGO; tipoEmpleado.Nombre = row.NOMBRE; tipos.Add(tipoEmpleado); } return(tipos); }
public void delete(TipoEmpleadoEntity tipoEmpleado) { adapter.DeleteByCodigo(tipoEmpleado.Codigo); }
public void create(TipoEmpleadoEntity tipoEmpleado) { adapter.Insert(tipoEmpleado.Nombre); }
public void update(TipoEmpleadoEntity tipoEmpleado) { throw new NotImplementedException(); }