Esempio n. 1
0
        /// <summary>
        ///Muestra el listado de constancias educativas ingresadas para el empleado
        /// </summary>
        private void CargarConstancias()
        {
            try
            {
                ConstanciaEducativaLN ln = new ConstanciaEducativaLN();
                var constancias          = ln.ConsultarConstanciaParaEmpleado(Convert.ToInt32(Session["id"].ToString()));

                for (int i = 0; i < constancias.Rows.Count; i++)
                {
                    int fil = i + 1;
                    int id  = Convert.ToInt32(constancias.Rows[i]["id_constancia"]);
                    tabla_historial_educativo.Rows.Add(NewRow());
                    tabla_historial_educativo.Rows[fil].Cells.Add(NewCell());
                    tabla_historial_educativo.Rows[fil].Cells.Add(NewCell());
                    tabla_historial_educativo.Rows[fil].Cells.Add(NewCell());
                    tabla_historial_educativo.Rows[fil].Cells.Add(NewCell());
                    tabla_historial_educativo.Rows[fil].Cells.Add(NewCell());
                    tabla_historial_educativo.Rows[fil].Cells.Add(NewCell());

                    tabla_historial_educativo.Rows[fil].Cells[0].Text = obtenerNivel(constancias.Rows[i]["id_nivel"].ToString());
                    tabla_historial_educativo.Rows[fil].Cells[1].Text = constancias.Rows[i]["lugar"].ToString();
                    tabla_historial_educativo.Rows[fil].Cells[2].Text = constancias.Rows[i]["descripcion"].ToString();
                    tabla_historial_educativo.Rows[fil].Cells[3].Text = Convert.ToDateTime(constancias.Rows[i]["fecha_desde"]).ToShortDateString();
                    tabla_historial_educativo.Rows[fil].Cells[4].Text = Convert.ToDateTime(constancias.Rows[i]["fecha_hasta"].ToString()).ToShortDateString();
                    tabla_historial_educativo.Rows[fil].Cells[5].Controls.Add(BotonEditarConstancia(constancias.Rows[i]["id_constancia"].ToString()));


                    if (constancias.Rows[i]["ruta"].ToString() != string.Empty)
                    {
                        tabla_historial_educativo.Rows[fil].Cells[5].Controls.Add(BotonDescargar(constancias.Rows[i]["ruta"].ToString()));
                    }
                    tabla_historial_educativo.Rows[fil].Cells[5].Controls.Add(BotonEliminar(constancias.Rows[i]["id_constancia"].ToString()));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Esempio n. 2
0
        private void CrearConstancia()
        {
            var constanciaLN = new ConstanciaEducativaLN();
            var archivo      = new ArchivoLN();
            var data         = ObtenerDatosConstanciaEducativa();

            if (BanderaCargoComprobante.Value == "1" && data.id_archivo.HasValue && data.archivo_url != string.Empty)
            {
                var resultado = archivo.ModificarArchivo(new Archivo
                {
                    url = data.archivo_url
                    ,
                    id_archivo = data.id_archivo ?? 0
                });

                data.id_archivo = resultado.id_archivo;
            }
            else if (!data.id_archivo.HasValue && data.archivo_url != string.Empty)
            {
                var resultado = archivo.NuevoArchivo(new Archivo
                {
                    url = data.archivo_url
                });
                data.id_archivo = resultado.id_archivo;
            }

            DataTable dt = constanciaLN.AgregarConstancia(data);

            if (!dt.HasErrors)
            {
                Response.Redirect("Editar.aspx?id=" + Request["id"]);
            }
            else
            {
                l_error.Visible   = true;
                l_error.InnerText = "Error inesperado";
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Carga todos los datos que se tienen actualmente del empleado que se va a editar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            String    usuario = this.Session["usuario"].ToString();
            UsuarioAD Datos   = new UsuarioAD();
            DataTable Usuario = Datos.usuarioRRHH(usuario);

            if (Usuario.Rows.Count == 0)
            {
                RRHH.Value = "0";
            }
            else
            {
                RRHH.Value = "1";
            }

            int         idConstancia = 0;
            EmpleadosLN empleadoLN   = new EmpleadosLN();

            Session["id"] = Request["id"];
            id            = Convert.ToInt32(Request["id"]);
            DataTable result = empleadoLN.GetEmpleado(id);

            if (Page.IsPostBack && Request["delC"] != null && int.TryParse(Request["delC"].ToString(), out idConstancia))
            {
                ConstanciaEducativaLN ln = new ConstanciaEducativaLN();
                ln.EliminarConstancia(new ConstanciaEducativa
                {
                    id_constancia = idConstancia
                });
            }
            string eventTarget = Request.Params.Get("__EVENTTARGET");

            if (Page.IsPostBack && Request["loadC"] != null && int.TryParse(Request["loadC"].ToString(), out idConstancia) &&
                (eventTarget != string.Empty)
                )
            {
                if (eventTarget != "ctl00$ContentPlaceHolder3$btnAgregarConstanciaEdu")
                {
                    ConstanciaEducativaLN ln = new ConstanciaEducativaLN();
                    var dt = ln.ConsultarConstancia(idConstancia);
                    CargarConstanciaEdicion(dt);
                }
            }

            if (!Page.IsPostBack)
            {
                LlenarDropDowns();

                if (!result.HasErrors)
                {
                    l_empleado.Text = result.Rows[0]["codigo"].ToString() + " - "
                                      + result.Rows[0]["primer_nombre"].ToString() + " " + result.Rows[0]["primer_apellido"].ToString();

                    codigo.Value           = result.Rows[0]["codigo"].ToString();
                    primer_nombre.Value    = result.Rows[0]["primer_nombre"].ToString();
                    primer_apellido.Value  = result.Rows[0]["primer_apellido"].ToString();
                    segundo_nombre.Value   = result.Rows[0]["segundo_nombre"].ToString();
                    segundo_apellido.Value = result.Rows[0]["segundo_apellido"].ToString();
                    apellido_casada.Value  = result.Rows[0]["apellido_casada"].ToString();

                    cui.Value = result.Rows[0]["cui"].ToString();
                    fecha_nacimiento.Value      = Convert.ToDateTime(result.Rows[0]["fecha_nacimiento"].ToString()).ToString("yyyy-MM-dd");
                    lugar_nacimiento.Value      = result.Rows[0]["lugar_nacimiento"].ToString();
                    d_genero.Value              = result.Rows[0]["id_genero"].ToString();
                    d_profesion.Value           = result.Rows[0]["id_profesion"].ToString();
                    d_estado_civil.Value        = result.Rows[0]["id_estado_civil"].ToString();
                    casa_propia.Checked         = result.Rows[0]["tipo_vivienda"].ToString() == "1" ? true : false;
                    alquiler.Checked            = result.Rows[0]["tipo_vivienda"].ToString() == "1" ? false : true;
                    direccion_residencial.Value = result.Rows[0]["direccion_residencial"].ToString();
                    correo.Value               = result.Rows[0]["correo"].ToString();
                    telefono_movil.Value       = result.Rows[0]["telefono_movil"].ToString();
                    telefono_residencial.Value = result.Rows[0]["telefono_residencial"].ToString();
                    igss.Value              = result.Rows[0]["afiliacion_igss"].ToString();
                    nit.Value               = result.Rows[0]["nit"].ToString();
                    d_tipo_licencia.Value   = result.Rows[0]["id_tipo_licencia"].ToString();
                    numero_licencia.Value   = result.Rows[0]["licencia_conducir"].ToString();
                    imagenEmpleado.ImageUrl = result.Rows[0]["ruta"]?.ToString().Trim() == string.Empty ?
                                              "~/Content/Imagenes/empleado_default.png" :
                                              result.Rows[0]["ruta"]?.ToString().Trim();
                    banderaCambioImagen.Value = "0";
                    id_archivo.Value          = result.Rows[0]["id_fotografia"]?.ToString().Trim() ?? "";
                    d_tipo_sangre.Value       = result.Rows[0]["id_tipo_sangre"].ToString();
                    //Carga Tabs
                    ListadoFamiliares();
                    CargarConstancias();
                    DarValoresAlergiasEnfermedades();
                    LlenarContrato(id);
                    d_municipio_cui.Value        = result.Rows[0]["id_municipio_cui"].ToString();
                    d_municipio_residencia.Value = result.Rows[0]["id_municipio_residencial"].ToString();
                }
            }
        }