protected void btnCargaEmpleado_Click(object sender, EventArgs e) { Usuario us = (Usuario)(Session["Usuario"]); EmpleadoMngr emp = new EmpleadoMngr(); if (txtNombre.Value != "" && txtApellido.Value != "" && txtCuil.Value != "" && ddlAgrupacion.Value != "" && ddlCategoria.Value != "" && ddlTipoContrato.Value != "" && ddlJornada.Value != "" && DateTime.Parse(txtFechaAlta.Text) != null) { if (hdnEdit.Value == "0") { emp.insertEmpleado(us.IdEmpleador, txtNombre.Value, txtApellido.Value, txtCuil.Value, ddlAgrupacion.Value, ddlCategoria.Value, ddlTipoContrato.Value, ddlJornada.Value, DateTime.Parse(txtFechaAlta.Text)); } else { DateTime?fechabaja = string.IsNullOrEmpty(txtFechaBaja.Text) ? (DateTime?)null : DateTime.Parse(txtFechaBaja.Text); emp.editEmpleado(int.Parse(hdnIdEmpleado.Value), txtNombre.Value, txtApellido.Value, txtCuil.Value, ddlAgrupacion.Value, ddlCategoria.Value, ddlTipoContrato.Value, ddlJornada.Value, DateTime.Parse(txtFechaAlta.Text), fechabaja); } cargarEmpleados(us); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "closeModal();", true); } else { lblError.Visible = true; } }
public static List <Empleado> GetEmpleadosByEmpleador(string idEmpleador) { List <Empleado> empleadoList = new List <Empleado>(); EmpleadoMngr empleadoMng = new EmpleadoMngr(); empleadoList = empleadoMng.getEmpleadosByIdEmpleador(int.Parse(idEmpleador)); return(empleadoList); }
protected void cargarEmpleados(Usuario us) { EmpleadoMngr emp = new EmpleadoMngr(); List <Empleado> EmpleList = new List <Empleado>(); if (System.Configuration.ConfigurationManager.AppSettings["SinDB"].ToString() == "True") { Empleado emp1 = new Empleado(); emp1.IdEmpleador = 1; emp1.IdEmpleado = 1; emp1.Nombre = "Gonzalo"; emp1.Apellido = "Maciel"; emp1.Cuil = "2392562569"; emp1.Agrupacion = "Otros"; emp1.Categoria = "Cuarta"; emp1.TipoContrato = "Permanente"; emp1.Jornada = "Completa"; emp1.FechaAlta = "01/01/2017"; EmpleList.Add(emp1); Empleado emp2 = new Empleado(); emp2.IdEmpleador = 1; emp2.IdEmpleado = 1; emp2.Nombre = "Melina"; emp2.Apellido = "Maldonado"; emp2.Cuil = "238545549"; emp2.Agrupacion = "Otros"; emp2.Categoria = "Cuarta"; emp2.TipoContrato = "Permanente"; emp2.Jornada = "Completa"; emp2.FechaAlta = "01/01/2017"; EmpleList.Add(emp2); } else { EmpleList = emp.getEmpleadosByIdEmpleador(us.IdEmpleador); } gvEmpleados.DataSource = EmpleList; gvEmpleados.DataBind(); if (gvEmpleados.Rows.Count != 0) { gvEmpleados.UseAccessibleHeader = true; gvEmpleados.HeaderRow.TableSection = TableRowSection.TableHeader; } }