예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            entidadSC = new AuditoriaIntelectual();
            negocioSC = new Indicadores();
            negocioEva = new NegocioPlantillaEva();
            // Iniciar atributos
            this.capitalHumano = new NegocioCapitalHumano();
            this.capacitacion = new negCapacitaciones();

            String username = (string)(Session["Username"]);
            ValidadSession();

             //txtNoEmpleado.Text = 

             AppsEntities.usuario objUsuario = new AppsEntities.usuario();
             objUsuario.Usuario = username;
             AppsBO.usuarioBO objusuarioBO = new AppsBO.usuarioBO();
             objUsuario = objusuarioBO.Retrieve(objUsuario);
             txtNoEmpleado.Text = objUsuario.Usr_id_JDE_AB;

           // panelFiltros.CssClass = "da-panel collapsible";
            CreateTable();
            CreateGrid();
            CreateGrid2();
            CreateGrid5();
            CreateGrid_eva();
            panel4.Visible = true; //panel de evaluacion desempeño
            panel8.Visible = true;
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            entidadSC = new SeguimientoCompras();
            negocioSC = new Indicadores();

            if (Page.IsPostBack == false) // Se carga la pagina por primera vez
            {
                this.txtOrdenCompra.Focus();

                ValidadSession();
                CargarDdlCompañias();
            }
        }
예제 #3
0
        protected void GridBuscar_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //-----------------------------
            switch (e.CommandName)
            {
                case "comandoCompetencias":

                    GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer;

                    string numeroempleado = Convert.ToString(gridBuscar.DataKeys[row.RowIndex].Values[0]);

                    AuditoriaIntelectual entidadSC = new AuditoriaIntelectual();

                    entidadSC.NumeroEmpleado = numeroempleado;

                    Indicadores negocioSC = new Indicadores();

                    DataTable datos = negocioSC.BuscarDetalleCompetencias(entidadSC);

                    if (datos == null)
                    {
                        // Muestra mensaje Error
                        MensajeErrorFiltros(negocioSC.Log);
                    }
                    else
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(string.Empty);

                        // Se llena el grid con los resultados
                        gridDetalleCompetencias.DataSource = datos;
                        gridDetalleCompetencias.DataBind();


                        if (datos.Rows.Count != 0)
                        {
                            gridDetalleCompetencias.UseAccessibleHeader = true;
                            gridDetalleCompetencias.HeaderRow.TableSection = TableRowSection.TableHeader;
                        }

                        // Muestra Pop-up
                        dialogoDetalleCompetencias.Show();
                    }

                    dialogoDetalleCompetencias.Show();

                    break;

                case "comandoEquipo":

                    GridViewRow row2 = (GridViewRow)((Control)e.CommandSource).NamingContainer;

                    string numeroempleado2 = Convert.ToString(gridBuscar.DataKeys[row2.RowIndex].Values[0]);

                    AuditoriaIntelectual entidadCotejoSC = new AuditoriaIntelectual();

                    entidadCotejoSC.NumeroEmpleado = numeroempleado2;

                    Indicadores negocioEquipoSC = new Indicadores();

                    DataTable datosEquipo = negocioEquipoSC.BuscarDetalleEquipo(entidadCotejoSC);

                    if (datosEquipo == null)
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(negocioEquipoSC.Log);
                    }
                    else
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(string.Empty);

                        // Se llena el grid con los resultados
                        gridDetalleEquipo.DataSource = datosEquipo;
                        gridDetalleEquipo.DataBind();

                        if (datosEquipo.Rows.Count != 0)
                        {
                            gridDetalleEquipo.UseAccessibleHeader = true;
                            gridDetalleEquipo.HeaderRow.TableSection = TableRowSection.TableHeader;
                        }

                        // Muestra Pop-up
                        dialogoDetalleEquipo.Show();
                    }

                    dialogoDetalleEquipo.Show();

                    break;

                case "comandoEmpleosAnteriores":

                    GridViewRow row3 = (GridViewRow)((Control)e.CommandSource).NamingContainer;

                    string numeroempleado3 = Convert.ToString(gridBuscar.DataKeys[row3.RowIndex].Values[0]);

                    AuditoriaIntelectual entidadEmpleosSC = new AuditoriaIntelectual();

                    entidadEmpleosSC.NumeroEmpleado = numeroempleado3;

                    Indicadores negocioEmpleosSC = new Indicadores();

                    DataTable datosEmpleos = negocioEmpleosSC.BuscarDetalleEmpleosAnteriores(entidadEmpleosSC);

                    if (datosEmpleos == null)
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(negocioEmpleosSC.Log);
                    }
                    else
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(string.Empty);
                        // Se llena el grid con los resultados
                        gridDetalleEmpleosAnteriores.DataSource = datosEmpleos;
                        gridDetalleEmpleosAnteriores.DataBind();
                        if (datosEmpleos.Rows.Count != 0)
                        {
                            gridDetalleEmpleosAnteriores.UseAccessibleHeader = true;
                            gridDetalleEmpleosAnteriores.HeaderRow.TableSection = TableRowSection.TableHeader;
                        }
                        // Muestra Pop-up
                        dialogoDetalleEmpleos.Show();
                    }
                    dialogoDetalleEmpleos.Show();
                    break;


                case "comandoDigitalizaciones":
                    GridViewRow row4 = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                    string numeroempleado4 = Convert.ToString(gridBuscar.DataKeys[row4.RowIndex].Values[0]);
                    //string nombreempleado4 = Convert.ToString(gridBuscar.DataKeys[row4.RowIndex].Values[1]);
                    Digitalizaciones entidadDigitlizacionesSC = new Digitalizaciones();
                    entidadDigitlizacionesSC.NumeroEmpleado = numeroempleado4;
                    lblNumeroEmpleado.Text = numeroempleado4;
                    //lblNombreEmpleado.Text = nombreempleado4;
                    Indicadores negocioDigitalizacionesSC = new Indicadores();

                    //DataTable datosDigitalizaciones = negocioDigitalizacionesSC.BuscarDetalleDigitalizaciones(entidadDigitlizacionesSC);

                    //if (datosDigitalizaciones == null)
                    //{
                    //    // Oculta mensaje de error
                    //    MensajeErrorFiltros(negocioDigitalizacionesSC.Log);
                    //}
                    //else
                    //{
                    //    // Oculta mensaje de error
                    //    MensajeErrorFiltros(string.Empty);

                    //    // Se llena el grid con los resultados
                    //    gridDetalleDigitalizacion.DataSource = datosDigitalizaciones;
                    //    gridDetalleDigitalizacion.DataBind();

                    //    if (datosDigitalizaciones.Rows.Count != 0)
                    //    {
                    //        gridDetalleDigitalizacion.UseAccessibleHeader = true;
                    //        gridDetalleDigitalizacion.HeaderRow.TableSection = TableRowSection.TableHeader;
                    //    }

                    //    // Muestra Pop-up
                    //    dialogoDetalleDigitalizaciones.Show();
                    //}

                    dialogoDetalleDigitalizaciones.Show();


                    // MUESTRA EL GRID detalle
                    using (SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["conexionAPPS"].ToString()))
                    {
                        cnx.Open();
                        string query = " SELECT doc_IdArchivo, doc_nombre, doc_ruta, doc_IdEmpleado, doc_tipo, doc_subtipo, doc_agrupador, " +
                                       "        doc_Mes, doc_anio, doc_descripcion, doc_ruta+doc_nombre as rutacompleta " +
                                       " FROM   AUD_EXPEDIENTE " +
                                       " WHERE (doc_IdEmpleado = '" + numeroempleado4 + "') ";
                        SqlCommand cmd = new SqlCommand(query, cnx);
                        SqlDataReader myReader = cmd.ExecuteReader();
                        grid2.DataSource = myReader;
                        grid2.DataBind();
                        grid2.AllowGrouping = true;
                        grid2.GroupBy = "doc_tipo";
                    }
                    break;
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            entidadSC = new AuditoriaIntelectual();
            negocioSC = new Indicadores();
            negocioEva = new NegocioPlantillaEva();
            // Iniciar atributos
            this.capitalHumano = new NegocioCapitalHumano();
            this.capacitacion = new negCapacitaciones();

            //para sacar permiso menu
            String username = (string)(Session["Username"]);
            AppsEntities.usuario objUsuario = new AppsEntities.usuario();
            AppsBO.usuarioBO objusuarioBO = new AppsBO.usuarioBO();
            objUsuario.Usuario = username;
            int tienepermiso4 = objusuarioBO.tienePermisoMenu(objUsuario, 6);
            if (tienepermiso4 > 0)
            {
                //si tiene permiso
                if (Page.IsPostBack == false) // Se carga la pagina por primera vez
                {
                    this.txtNoEmpleado.Focus();
                    ValidadSession();
                    CargarddlUN();
                    CargarddlGAcademico();
                    CargarddlEspecialidades();
                    CargarPuestos();
                    CargarddlTipoDctoExp();
                    CargarddlEspecialidades();
                    CargarddlCategorias();
                    CargarTipos();
                    CargarddlCursos();
                    panel5.Visible = false;
                    panel6.Visible = false;
                    panel8.Visible = false;
                }
            }
            else
            {
                Lbpermiso.Text = "NO TIENES PERMISO PARA ESTE MODULO";
                panelResultado.Visible = false;
                panelFiltros.Visible = false;
                panel3.Visible = false;
                panel5.Visible = false;
                panel6.Visible = false;
                panel8.Visible = false;
            }
        }
예제 #5
0
        protected void cmdAgrega_documento_Click(object sender, EventArgs e)
        {
            string vigenciaini;
            string vigenciafin;
            Digitalizaciones entidadDigitlizacionesSC = new Digitalizaciones();
            string NombreArchivo = "";
            string nombreempleado = "";
            string RutArchivo = "";
            string nomtxt = "";
            string yourDirectory = "";
            string nombrecurso = "";
            string idcurso = "";
            string ultimoidcurso = "";
            string totalarchivos="";
            string anexo="";
            string Agrupacion="";
            string FechaIniVig ="";
            string FechaFinVig ="";
            int graba = 1;
            MensajeError(string.Empty);
            MensajeExito(string.Empty);

            if (ddlCurso.SelectedValue=="*")
            {
                graba = 0;
            }
            if (ddlModalidad.SelectedValue == "*")
            {
                graba = 0;
            }
            if (ddlModalidad.SelectedValue == "*")
            {
                graba = 0;
            }

            if (graba == 0)
            {
                MensajeError("Debe seleccionar algun curso o una modalidad");
                graba = 0;
            }
            else
            {
                // Guarda la capacitacion del curso tomado en detalle de capacitacion
                Capacitaciones entidadCapacitaciones = new Capacitaciones();
                entidadCapacitaciones.idcurso = ddlCurso.SelectedValue;
                entidadCapacitaciones.idproveedor = ddlProveedor.SelectedValue;
                entidadCapacitaciones.idempleado = txtNoEmpleado.Text;
                entidadCapacitaciones.modalidad = ddlModalidad.SelectedValue;
                entidadCapacitaciones.lugar = txtLugar.Text;
                entidadCapacitaciones.costo = txtCosto.Text;
                entidadCapacitaciones.area = ddlAreaPersonal.SelectedValue;
                entidadCapacitaciones.areapersonal = ddlAreaPersonal.SelectedValue; //cambiar
                //entidadCapacitaciones.moneda = txtmoneda.Text;
                entidadCapacitaciones.moneda = dllMoneda.SelectedValue;
                entidadCapacitaciones.departamento = txtDepartamento.Text;
                entidadCapacitaciones.duracionhrs = txthoras.Text;
                entidadCapacitaciones.observaciones = txtObservaciones.Text;
                // entidadCapacitaciones.duracionhrs = txthoras.Text;
                //para la fecha inicio de vigencia de capacitacion
                if (!string.IsNullOrEmpty(txtFechainivig.Text))
                {
                    vigenciaini = txtFechainivig.Text; //24/05/2015
                    string[] parts = vigenciaini.Split('/');
                    string anio = parts[2];
                    string mes = parts[1];
                    string dia = parts[0];
                    entidadCapacitaciones.fechainicurso = dia + "/" + mes + "/" + anio;
                }
                else
                {
                    entidadCapacitaciones.fechainicurso = "";
                }
                // para la fecha fin de vigencia
                if (!string.IsNullOrEmpty(txtfechafinvig.Text))
                {
                    vigenciafin = txtfechafinvig.Text; //24/05/2015
                    string[] parts = vigenciafin.Split('/');
                    string anio = parts[2];
                    string mes = parts[1];
                    string dia = parts[0];
                    entidadCapacitaciones.fechafincurso = dia + "/" + mes + "/" + anio;
                }
                else
                {
                    entidadCapacitaciones.fechafincurso = "";
                }

                string nomusuario = (string)(Session["Nombre"]);
                string claveusuario = (string)(Session["ClaveJDE"]);

                if (claveusuario == null)
                {
                    entidadCapacitaciones.userlogin = nomusuario;
                }
                else
                {
                    entidadCapacitaciones.userlogin = claveusuario;
                }

                negCapacitacionesSQL negocioCapacitaciones = new negCapacitacionesSQL();
                try
                {
                    negocioCapacitaciones.InsertaCapacitaciones(entidadCapacitaciones);
                }
                catch (Exception d)
                {
                    MensajeErrorFiltros("No se pudo guardar, ocurrio un Error:  " + negocioCapacitaciones.Log);
                    return;
                }

                // AQUI CHECA SI SE ADJUNTO ALGUN ARCHIVO Y LO GUARDA EN LA TABLA AUD_EXPEDIENTE en caso de que tambien agrege doctos digitalizados.
                Boolean fileOK = false;
                if (fupCargarDigitalizacion.HasFile)
                {
                    String fileExtension = System.IO.Path.GetExtension(fupCargarDigitalizacion.FileName).ToLower();
                    String[] allowedExtensions = { ".pdf" };
                    for (int i = 0; i < allowedExtensions.Length; i++)
                    {
                        if (fileExtension == allowedExtensions[i])
                        {
                            fileOK = true;
                        }
                    }
                }

                if (fileOK)
                {

                    try
                    {
                        RutArchivo = "Expedientes/";
                        nomtxt = TxtEmpleado.Text;
                        //nombre con guin sobre los espacios
                        nombreempleado = nomtxt.Replace(" ", "_");
                        idcurso = ddlCurso.SelectedValue;

                        //para sacar el idcurso
                        string connectionString = ConfigurationManager.ConnectionStrings["conexionAPPS"].ConnectionString;
                        using (SqlConnection cnx = new SqlConnection(connectionString))
                        {
                            cnx.Open();
                            string query = "select * from AUD_C_CURSOS where id_curso= '" + idcurso + "' ";
                            SqlCommand cmd = new SqlCommand(query, cnx);
                            SqlDataReader dr = cmd.ExecuteReader();
                            if (dr.HasRows)
                            {
                                while (dr.Read())
                                {
                                    nombrecurso = dr["descripcion_curso"].ToString();
                                }
                            }
                            else
                            {
                                nombrecurso = idcurso;  //sino existe pongo el numero de id del curso
                            }
                        }   // cierre de la conn
                        using (SqlConnection cnx = new SqlConnection(connectionString))
                        {
                            cnx.Open();
                            string query = "SELECT max(doc_id) as ultimoidcurso FROM AUD_D_CAPACITACION ";
                            SqlCommand cmd = new SqlCommand(query, cnx);
                            SqlDataReader dr = cmd.ExecuteReader();
                            if (dr.HasRows)
                            {
                                while (dr.Read())
                                {
                                    ultimoidcurso = dr["ultimoidcurso"].ToString();
                                }
                            }
                            else
                            {
                                ultimoidcurso = "0";  //sino existe pongo el numero de id del curso
                            }
                        }   // cierre de la conn

                        //=======================aqui va el codigo para guardar cuando son mas archivos

                        //====================================AQUI VAN LOS DATOS A GUARDAR================================
                        HttpFileCollection uploadedFiles = Request.Files;
                        for (int i = 0; i < uploadedFiles.Count; i++)
                        {
                            HttpPostedFile userPostedFile = uploadedFiles[i];
                            try
                            {  //recorre el upload tanto archivos se hayam subido
                                if (userPostedFile.ContentLength > 0)
                                {
                                    //Label1.Text += "<br><u>File #" + (i + 1) + "</u><br>";
                                    //Label1.Text += "File Content Type: " + userPostedFile.ContentType + "<br>";
                                    //Label1.Text += "File Size: " + userPostedFile.ContentLength + "kb<br>";
                                    //Label1.Text += "File Name: " + userPostedFile.FileName + "<br>";

                                    // ---AQUI DEBE IR TODO LO LOS DATOS QUE SE VAYAN A GUARDAR RUTA Y NOMBRE DEL LOS ARCHIVOS EN AUD EXPEDIENTE
                                    //==============================busco los demas datos para buscar sus cursos
                                    using (SqlConnection cnx = new SqlConnection(connectionString))
                                    {
                                        cnx.Open();
                                        string query = " SELECT COUNT(doc_IdArchivo) as totalarchivos " +
                                                       " FROM AUD_EXPEDIENTE " +
                                                       " WHERE (doc_id_curso = '" + idcurso + "') AND (doc_IdEmpleado = '" + txtNoEmpleado.Text + "') " +
                                                       " order by 1 ";

                                        SqlCommand cmd = new SqlCommand(query, cnx);
                                        SqlDataReader dr = cmd.ExecuteReader();
                                        if (dr.HasRows)
                                        {
                                            while (dr.Read())
                                            {
                                                totalarchivos = dr["totalarchivos"].ToString();
                                            }
                                        }
                                        else
                                        {
                                            totalarchivos = "0";  //sino existe
                                        }
                                    }   // cierre de la conn

                                    if (totalarchivos == "1")
                                    {
                                        anexo = "Parte2";
                                    }
                                    if (totalarchivos == "2")
                                    {
                                        anexo = "Parte3";
                                    }
                                    if (totalarchivos == "3")
                                    {
                                        anexo = "Parte4";
                                    }
                                    if (totalarchivos == "4")
                                    {
                                        anexo = "Parte5";
                                    }
                                    if (totalarchivos == "5")
                                    {
                                        anexo = "Parte6";
                                    }
                                    if (totalarchivos == "6")
                                    {
                                        anexo = "Parte7";
                                    }
                                    if (totalarchivos == "7")
                                    {
                                        anexo = "Parte8";
                                    }
                                    if (totalarchivos == "8")
                                    {
                                        anexo = "Parte9";
                                    }
                                    if (totalarchivos == "9")
                                    {
                                        anexo = "Parte10";
                                    }
                                    if (totalarchivos == "10")
                                    {
                                        anexo = "Parte11";
                                    }
                                    if (Convert.ToInt32(totalarchivos) > 11)
                                    {
                                        lbEstatus.Text += "Solo puedes subir maximo 10";
                                        return;
                                    }

                                    //directorio donde se guardara el archivo 
                                    if (totalarchivos == "0")
                                    {
                                        string rutaserver = HttpContext.Current.Server.MapPath("/Expedientes/");
                                        NombreArchivo = rutaserver + nomtxt + "\\" + nombrecurso + "_" + nombreempleado + "_" + txtNoEmpleado.Text + ".pdf";
                                        entidadDigitlizacionesSC.NombreArchivo = nombrecurso + "_" + nombreempleado + "_" + txtNoEmpleado.Text + ".pdf";
                                    }
                                    else
                                    {
                                        string rutaserver = HttpContext.Current.Server.MapPath("/Expedientes/");
                                        NombreArchivo = rutaserver + nomtxt + "\\" + nombrecurso + "-" + nombreempleado + "_" + txtNoEmpleado.Text + "_" + anexo + ".pdf";
                                        entidadDigitlizacionesSC.NombreArchivo = nombrecurso + "-" + nombreempleado + "_" + txtNoEmpleado.Text + "_" + anexo + ".pdf";
                                    }
                                     string rutaserver2 = HttpContext.Current.Server.MapPath("/Expedientes/");
                                    //yourDirectory = "C:\\Users\\Public\\Documents\\APPS\\APPS\\Apps\\Documentos\\Expedientes\\" + nomtxt + "\\";
                                     yourDirectory = rutaserver2 + nomtxt + "\\";
                                    // para validar que exista el directorio donde se va guardar el archivo 
                                    if (!Directory.Exists(yourDirectory))
                                    {
                                        Directory.CreateDirectory(yourDirectory);
                                        //fupCargarDigitalizacion.PostedFile.SaveAs(NombreArchivo);
                                        userPostedFile.SaveAs(NombreArchivo);
                                        lbEstatus.Text = "  Estado: Archivo subido! ";
                                    }
                                    else
                                    {
                                        //fupCargarDigitalizacion.PostedFile.SaveAs(NombreArchivo);
                                        userPostedFile.SaveAs(NombreArchivo);
                                        lbEstatus.Text = "   Estado: Archivo subido! ";
                                    }

                                    FechaIniVig = txtFechainivig.Text;
                                    FechaFinVig = txtfechafinvig.Text;

                                    //busco los demas datos
                                    using (SqlConnection cnx = new SqlConnection(connectionString))
                                    {
                                        cnx.Open();
                                        string query = " SELECT  doc_IdArchivo, doc_nombre, doc_ruta, doc_IdEmpleado, doc_tipo, doc_subtipo, " +
                                                       "         doc_agrupador, doc_Mes, doc_anio, doc_descripcion, doc_alta, doc_user, " +
                                                       "         doc_id_curso, doc_id_capacitacion, doc_fecha_ini_vig, doc_fecha_fin_vig " +
                                                       " FROM    AUD_EXPEDIENTE " +
                                                       " WHERE   (doc_id_curso = '" + idcurso + "') AND (doc_IdEmpleado = '" + txtNoEmpleado.Text.Trim() + "')";

                                        SqlCommand cmd = new SqlCommand(query, cnx);
                                        SqlDataReader dr = cmd.ExecuteReader();
                                        if (dr.HasRows)
                                        {
                                            while (dr.Read())
                                            {
                                                Agrupacion = dr["doc_agrupador"].ToString();

                                                if (!string.IsNullOrEmpty(FechaIniVig))
                                                {
                                                    FechaIniVig = dr["doc_fecha_ini_vig"].ToString();
                                                    FechaFinVig = dr["doc_fecha_fin_vig"].ToString();
                                                }
                                            }
                                        }
                                        else
                                        {
                                            Agrupacion = "";  //sino existe pongo el numero de id del curso
                                        }
                                    }   // cierre de la conn

                                    if (Agrupacion == "")
                                    {
                                        Agrupacion = ddlGrupoExp.SelectedValue;
                                    }


                                    if (totalarchivos == "0")
                                    {
                                        //para cambiar el formato de fechas
                                        if (!string.IsNullOrEmpty(FechaIniVig))
                                        {
                                            vigenciafin = FechaIniVig; // ejemplo 2015-12-01
                                            string[] parts = vigenciafin.Split('/');
                                            string anio = parts[2];
                                            //string[] parts2 = anio.Split(' ');
                                            //string anio2 = parts[2];
                                            string mes = parts[1];
                                            string dia = parts[0];
                                            entidadDigitlizacionesSC.FechaIniVig = dia + "/" + mes + "/" + anio;
                                        }
                                        else
                                        {
                                            entidadDigitlizacionesSC.FechaIniVig = "";
                                        }
                                        // para cambiar el formato de fecha 
                                        if (!string.IsNullOrEmpty(FechaFinVig))
                                        {
                                            vigenciafin = FechaFinVig; // ejemplo 2015-12-01
                                            string[] parts = vigenciafin.Split('/');
                                            string anio = parts[2];
                                            //string[] parts2 = anio.Split(' ');
                                            //string anio2 = parts[2];
                                            string mes = parts[1];
                                            string dia = parts[0];
                                            entidadDigitlizacionesSC.FechaFinVig = dia + "/" + mes + "/" + anio;
                                        }
                                        else
                                        {
                                            entidadDigitlizacionesSC.FechaFinVig = "";
                                        }
                                    }
                                    else
                                    {
                                        //para cambiar el formato de fechas
                                        if (!string.IsNullOrEmpty(FechaIniVig))
                                        {
                                            vigenciafin = FechaIniVig; // ejemplo 22/05/2014 09:00:00
                                            string[] parts = vigenciafin.Split('/');
                                            string anio = parts[2];
                                            //string[] parts2 = anio.Split(' ');
                                            //string anio2 = parts2[0];
                                            string mes = parts[1];
                                            string dia = parts[0];
                                            entidadDigitlizacionesSC.FechaIniVig = dia + "/" + mes + "/" + anio;
                                        }
                                        else
                                        {
                                            entidadDigitlizacionesSC.FechaIniVig = "";
                                        }
                                        // para cambiar el formato de fecha 
                                        if (!string.IsNullOrEmpty(FechaFinVig))
                                        {
                                            vigenciafin = FechaFinVig; // ejemplo 22/05/2014 09:00:00
                                            string[] parts = vigenciafin.Split('/');
                                            string anio = parts[2];
                                            //string[] parts2 = anio.Split(' ');
                                            //string anio2 = parts2[0];
                                            string mes = parts[1];
                                            string dia = parts[0];
                                            entidadDigitlizacionesSC.FechaFinVig = dia + "/" + mes + "/" + anio;
                                        }
                                        else
                                        {
                                            entidadDigitlizacionesSC.FechaFinVig = "";
                                        }

                                    }

                                    // aqui agrego los demas campos
                                    entidadDigitlizacionesSC.Ubicacion = RutArchivo + TxtEmpleado.Text.Trim() + "/";
                                    entidadDigitlizacionesSC.NumeroEmpleado = txtNoEmpleado.Text.Trim();
                                    entidadDigitlizacionesSC.TipoDocumento = nombrecurso;
                                    entidadDigitlizacionesSC.SubTipo = "CAPACITACION";
                                    entidadDigitlizacionesSC.Agrupacion = Agrupacion;
                                    entidadDigitlizacionesSC.Mes = DateTime.Now.ToString("MM");
                                    entidadDigitlizacionesSC.Anio = DateTime.Now.Year.ToString();
                                    entidadDigitlizacionesSC.IdCurso = idcurso;
                                    entidadDigitlizacionesSC.IdCapacitacion = ultimoidcurso;

                                    if (claveusuario == null)
                                    {
                                        entidadDigitlizacionesSC.Userlogin = nomusuario;
                                    }
                                    else
                                    {
                                        entidadDigitlizacionesSC.Userlogin = claveusuario;
                                    }

                                    Indicadores negocioDigitalizacionesSC = new Indicadores();
                                    try
                                    {
                                        //para guardar las digitalizaciones si es que subio el archivo
                                        negocioDigitalizacionesSC.InsertaDigitalizaciones2(entidadDigitlizacionesSC);
                                    }
                                    catch (Exception Ed)
                                    {
                                        MensajeErrorFiltros("No se pudo guardar la digitalizacion, ocurrio un Error:  " + negocioDigitalizacionesSC.Log);
                                        lbEstatus.Text = "No se pudo guardar la digitalizacion, ocurrio un error " + negocioDigitalizacionesSC.Log;
                                        return;
                                    }
                                }
                            }
                            catch (Exception Ex)
                            {
                                lbEstatus.Text += "Error: <br>" + Ex.Message;
                            }
                        }
                        
                    }
                    catch (Exception d)
                    {
                        //MensajeErrorFiltros("El Archivo no se pudo subir, ocurrio un Error:  " + d);
                        lbEstatus.BorderColor = Color.Red;
                        lbEstatus.Text = " Estado: El Archivo no se pudo subir ";
                        lbEstatus.BorderColor = Color.Red;
                        return;
                    }

                    //CreateGrid();
                }

                //===============================================================================================================================
                //        entidadDigitlizacionesSC.NombreArchivo = nombrecurso + "-" + nombreempleado + "_" + txtNoEmpleado.Text.Trim() + ".pdf";
                //        //directorio donde se guardara el archivo 
                //        NombreArchivo = "C:\\Users\\Public\\Documents\\APPS\\APPS\\Apps\\Documentos\\Expedientes\\" + nomtxt + "\\" + nombrecurso + "-" + nombreempleado + "_" + txtNoEmpleado.Text.Trim() + ".pdf";
                //        yourDirectory = "C:\\Users\\Public\\Documents\\APPS\\APPS\\Apps\\Documentos\\Expedientes\\" + nomtxt + "\\";
                //        // para validar que exista el directorio donde se va guardar el archivo 
                //        if (!Directory.Exists(yourDirectory))
                //        {
                //            Directory.CreateDirectory(yourDirectory);
                //            fupCargarDigitalizacion.PostedFile.SaveAs(NombreArchivo);
                //            StatusLabel.Text = "  Estado: Archivo subido! ";
                //        }
                //        else
                //        {
                //            fupCargarDigitalizacion.PostedFile.SaveAs(NombreArchivo);
                //            StatusLabel.Text = "   Estado: Archivo subido! ";
                //        }
                //        // aqui agrego los demas campos
                //        entidadDigitlizacionesSC.Ubicacion = RutArchivo + TxtEmpleado.Text.Trim() + "/";
                //        entidadDigitlizacionesSC.NumeroEmpleado = txtNoEmpleado.Text.Trim();
                //        entidadDigitlizacionesSC.TipoDocumento = nombrecurso;
                //        entidadDigitlizacionesSC.SubTipo = "CAPACITACION";
                //        entidadDigitlizacionesSC.Agrupacion = ddlGrupoExp.SelectedValue.Trim();
                //        entidadDigitlizacionesSC.Mes = DateTime.Now.ToString("MM");
                //        entidadDigitlizacionesSC.Anio = DateTime.Now.Year.ToString();
                //        entidadDigitlizacionesSC.FechaIniVig = entidadCapacitaciones.fechainicurso;
                //        entidadDigitlizacionesSC.FechaFinVig = entidadCapacitaciones.fechafincurso;
                //        entidadDigitlizacionesSC.IdCurso = ddlCurso.SelectedValue;

                //        entidadDigitlizacionesSC.IdCapacitacion = ultimoidcurso;

                //        if (claveusuario == null)
                //        {
                //            entidadDigitlizacionesSC.Userlogin= nomusuario;
                //        }
                //        else
                //        {
                //            entidadDigitlizacionesSC.Userlogin = claveusuario;
                //        }

                //        Indicadores negocioDigitalizacionesSC = new Indicadores();
                //        try
                //        {
                //            //para guardar las digitalizaciones si es que subio el archivo
                //            negocioDigitalizacionesSC.InsertaDigitalizaciones2(entidadDigitlizacionesSC);
                //        }
                //        catch (Exception ed)
                //        {
                //            MensajeErrorFiltros("No se pudo guardar la digitalizacion, ocurrio un Error:  " + negocioDigitalizacionesSC.Log);
                //            return;
                //        }
                //        //actualizo el grid
                //        CreateGrid();
                //    }
                //    catch (Exception d)
                //    {
                //        MensajeErrorFiltros("El Archivo no se pudo subir, ocurrio un Error:  " + d);
                //        StatusLabel.Text = " Estado: El Archivo no se pudo subir ";
                //        return;
                //    }
                //}

                CreateGrid();
                //limpia los detalles
                ddlCurso.SelectedIndex = 0;
                ddlProveedor.SelectedIndex = 0;
                ddlModalidad.SelectedIndex = 0;
                txtLugar.Text = null;
                txtFechainivig.Text = null;
                txtfechafinvig.Text = null;
                txtCosto.Text = null;
                ddlAreaPersonal.SelectedIndex = 0;
                ddlGrupoExp.SelectedIndex = 0;
                StatusLabel.Text = null;
                dllMoneda.SelectedIndex = 0;
                txthoras.Text = null;
                txtObservaciones.Text = null;
                //txtmoneda.Text = null;
                panel3.Visible = true;
                panel1.Visible = true;
                panelFiltros.CssClass = "da-panel collapsible";
                //CreateGrid();
            }

        }
예제 #6
0
        protected void GridBuscar_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
                case "comandoRecepcion":

                    GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer;

                    string ordenCodigo = Convert.ToString(gridBuscar.DataKeys[row.RowIndex].Values[4]);
                    string ordenTipo = Convert.ToString(gridBuscar.DataKeys[row.RowIndex].Values[5]);
                    string ordenNumeroLinea = Convert.ToString(gridBuscar.DataKeys[row.RowIndex].Values[6]);
                   
                    lblRecepcionOrdenCodigo.Text = ordenCodigo;
                    lblRecepcionOrdenTipo.Text = ordenTipo;
                    lblRecepcionOrdenLinea.Text = ordenNumeroLinea;

                    SeguimientoCompras entidadSC = new SeguimientoCompras();

                    entidadSC.Orden = ordenCodigo;
                    entidadSC.OrdenTipo = ordenTipo;
                    entidadSC.OrdenLinea = ordenNumeroLinea;

                    Indicadores negocioSC = new Indicadores();

                    DataTable datos = negocioSC.BuscarDetalleRecepcion(entidadSC);

                    if (datos == null)
                    {
                        // Muestra mensaje Error
                        MensajeErrorFiltros(negocioSC.Log);
                    }
                    else
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(string.Empty);

                        // Se llena el grid con los resultados
                        gridDetalleRecepcion.DataSource = datos;
                        gridDetalleRecepcion.DataBind();


                        if (datos.Rows.Count != 0)
                        {
                            gridDetalleRecepcion.UseAccessibleHeader = true;
                            gridDetalleRecepcion.HeaderRow.TableSection = TableRowSection.TableHeader;
                        }

                        // Muestra Pop-up
                        dialogoDetalleRecepcion.Show();
                     }
                  
                    dialogoDetalleRecepcion.Show();

                    break;

                case "comandoCotejo":

                    GridViewRow row2 = (GridViewRow)((Control)e.CommandSource).NamingContainer;

                    string ordenCodigo2 = Convert.ToString(gridBuscar.DataKeys[row2.RowIndex].Values[4]);
                    string ordenTipo2 = Convert.ToString(gridBuscar.DataKeys[row2.RowIndex].Values[5]);
                    string ordenNumeroLinea2 = Convert.ToString(gridBuscar.DataKeys[row2.RowIndex].Values[6]);

                    lblCotejoOrdenCodigo.Text = ordenCodigo2;
                    lblCotejoOrdenTipo.Text = ordenTipo2;
                    lblCotejoOrdenLinea.Text = ordenNumeroLinea2;

                    SeguimientoCompras entidadCotejoSC = new SeguimientoCompras();

                    entidadCotejoSC.Orden = ordenCodigo2;
                    entidadCotejoSC.OrdenTipo = ordenTipo2;
                    entidadCotejoSC.OrdenLinea = ordenNumeroLinea2;

                    Indicadores negocioCotejoSC = new Indicadores();

                    DataTable datosCotejo = negocioCotejoSC.BuscarCotejoPago(entidadCotejoSC);

                    if (datosCotejo == null)
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(negocioCotejoSC.Log);
                    }
                    else
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(string.Empty);

                        // Se llena el grid con los resultados
                        gridDetalleCotejo.DataSource = datosCotejo;
                        gridDetalleCotejo.DataBind();

                        if (datosCotejo.Rows.Count != 0)
                        {
                            gridDetalleCotejo.UseAccessibleHeader = true;
                            gridDetalleCotejo.HeaderRow.TableSection = TableRowSection.TableHeader;
                        }

                        gridDetalleCotejo.UseAccessibleHeader = true;
                        gridDetalleCotejo.HeaderRow.TableSection = TableRowSection.TableHeader;

                        // Muestra Pop-up
                        dialogoDetalleCotejo.Show();
                    }

                    dialogoDetalleCotejo.Show();

                    break;

                case "comandoAutorizadores":

                    GridViewRow row3 = (GridViewRow)((Control)e.CommandSource).NamingContainer;

                    string ordenCodigo3 = Convert.ToString(gridBuscar.DataKeys[row3.RowIndex].Values[4]);
                    string ordenTipo3 = Convert.ToString(gridBuscar.DataKeys[row3.RowIndex].Values[5]);
                    string ordenNumeroLinea3 = Convert.ToString(gridBuscar.DataKeys[row3.RowIndex].Values[6]);

                    lblCotejoOrdenCodigo.Text = ordenCodigo3;
                    lblCotejoOrdenTipo.Text = ordenTipo3;
                    lblCotejoOrdenLinea.Text = ordenNumeroLinea3;

                    SeguimientoCompras entidadAutorizadoresSC = new SeguimientoCompras();

                    entidadAutorizadoresSC.Orden = ordenCodigo3;
                    entidadAutorizadoresSC.OrdenTipo = ordenTipo3;
                    entidadAutorizadoresSC.OrdenLinea = ordenNumeroLinea3;

                    Indicadores negocioAutorizadoresSC = new Indicadores();

                    DataTable datosAutorizadores = negocioAutorizadoresSC.BuscarAutorizadoresSC(entidadAutorizadoresSC);

                    if (datosAutorizadores == null)
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(negocioAutorizadoresSC.Log);
                    }
                    else
                    {
                        // Oculta mensaje de error
                        MensajeErrorFiltros(string.Empty);

                        // Se llena el grid con los resultados
                        gridDetalleAutorizadores.DataSource = datosAutorizadores;
                        gridDetalleAutorizadores.DataBind();

                        if (datosAutorizadores.Rows.Count != 0)
                        {
                            gridDetalleAutorizadores.UseAccessibleHeader = true;
                            gridDetalleAutorizadores.HeaderRow.TableSection = TableRowSection.TableHeader;
                        }

                        gridDetalleAutorizadores.UseAccessibleHeader = true;
                        gridDetalleAutorizadores.HeaderRow.TableSection = TableRowSection.TableHeader;

                        // Muestra Pop-up
                        dialogoDetalleAutorizadores.Show();
                    }

                    dialogoDetalleAutorizadores.Show();

                    break;
            }
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            negocioEva = new NegocioPlantillaEva();
            negocioSC = new Indicadores();

            string noempleado = "";
            //ExportarPDF();
            noempleado = Session["idempl"].ToString();

            if (!Page.IsPostBack)
            {
                negocioSC = new Indicadores();
                noempleado = Session["idempl"].ToString();
                TxtEmpleado.Text = Session["idempl"].ToString();

                List<AuditoriaIntelectual> listaEmpEBS = negocioSC.ListaEmpleadosAI(TxtEmpleado.Text, "%", "%", "%", "%", "%", "%", "%", "%");
                if (listaEmpEBS == null)
                {
                    //no se tiene informacionde este empleado
                }
                else
                {
                    TxtEmpleado.Text = listaEmpEBS[0].Nombre.ToString();
                    lbNacionalidad.Text = listaEmpEBS[0].PaisNacimiento.ToString();
                    if (lbNacionalidad.Text == "MX")
                    {
                        lbNacionalidad.Text = "MEXICANA";
                    }

                    lbEstadoCiv.Text = listaEmpEBS[0].EstadoCivil.ToString();
                    //lbHijos.Text = listaEmpEBS[0].Nombre.ToString();
                    lbPuesto.Text = listaEmpEBS[0].Puesto.ToString();
                    lbFechaIng.Text = listaEmpEBS[0].FechaIng.ToString();
                    DateTime Hoy = DateTime.Today;
                    lbFecha.Text = Hoy.ToString("dd-MM-yyyy");
                    lbDepto.Text = listaEmpEBS[0].Departamento.ToString();
                    lbUbicacion.Text = listaEmpEBS[0].Ubicacion.ToString();
                    lbDireccion.Text = listaEmpEBS[0].Direccion.ToString();
                    lbCategoria.Text = listaEmpEBS[0].Categoria.ToString();
                    lbUltimoEst.Text = listaEmpEBS[0].UEstudio.ToString();
                    lbEspecialidad.Text = listaEmpEBS[0].Especialidad.ToString();
                    lbTitulo.Text = listaEmpEBS[0].GradoAcademico.ToString();

                    lbSalario.Text = listaEmpEBS[0].Salario2.ToString();
                    //lbHijos.Text = listaEmpEBS[0].Nombre.ToString();
                    //lbMaestria.Text = listaEmpEBS[0].Nombre.ToString();
                    //lbIdiomas.Text = listaEmpEBS[0].Nombre.ToString();
                    //lbEmpleo1.Text = listaEmpEBS[0].Nombre.ToString();
                    //lbEmpleo2.Text = listaEmpEBS[0].Nombre.ToString();
                    //lbEmpleo3.Text = listaEmpEBS[0].Nombre.ToString();
                    //lbCursosAnt.Text = listaEmpEBS[0].Nombre.ToString();
                    //para sacar que DIRECCION le corresponde busco por personid de sus jefe directo
                    List<AuditoriaIntelectual> listaEmpEBS3 = negocioSC.ListaEmpleadosAI(noempleado, "%", "%", "%", "%", "%", "%", "%", "%");
                    if (listaEmpEBS3 == null)
                    {
                        //MensajeErrorFiltros(negocioEva.Log + " No se encuentra empleado con este filtro");
                        return;
                    }
                    else
                    {
                        personid = listaEmpEBS3[0].personId.ToString();
                    }
                    List<AuditoriaIntelectual> listaDireccion = negocioSC.ListaDireccion(personid);

                    if (listaDireccion == null)
                    {
                        //totalempleados = "0";
                    }
                    else
                    {
                        jefedirecto = listaDireccion[0].CveJefeDirecto.ToString();
                        if (jefedirecto == string.Empty)
                        {
                            jefedirecto = listaDireccion[0].CveJefeDirecto.ToString();
                            nombrejefedirecto = listaDireccion[0].Nombre.ToString();
                            direccion = listaDireccion[0].Departamento.ToString();
                        }
                        else
                        {
                            int c = 0;
                            while (jefedirecto != string.Empty && direccion != "DIRECCION GENERAL" && c <= 4)
                            {
                                if (direccion == "")
                                {
                                    direccion = "-";
                                }

                                if (direccion.Length >= 9)
                                {
                                    direccion_test = direccion.Substring(0, 9);
                                }
                                else
                                {
                                    direccion_test = "-";
                                }

                                if (c == 0 && direccion_test != "DIRECCION")
                                {
                                    List<AuditoriaIntelectual> listaDireccion2 = negocioSC.ListaDireccion(jefedirecto);
                                    jefedirecto = listaDireccion2[0].CveJefeDirecto.ToString();
                                    nombrejefedirecto = listaDireccion2[0].Nombre.ToString();
                                    direccion = listaDireccion2[0].Departamento.ToString();
                                }
                                if (c == 1 && direccion_test != "DIRECCION")
                                {
                                    List<AuditoriaIntelectual> listaDireccion3 = negocioSC.ListaDireccion(jefedirecto);
                                    jefedirecto = listaDireccion3[0].CveJefeDirecto.ToString();
                                    nombrejefedirecto = listaDireccion3[0].Nombre.ToString();
                                    direccion = listaDireccion3[0].Departamento.ToString();
                                }
                                if (c == 2 && direccion_test != "DIRECCION")
                                {
                                    List<AuditoriaIntelectual> listaDireccion4 = negocioSC.ListaDireccion(jefedirecto);
                                    jefedirecto = listaDireccion4[0].CveJefeDirecto.ToString();
                                    nombrejefedirecto = listaDireccion4[0].Nombre.ToString();
                                    direccion = listaDireccion4[0].Departamento.ToString();
                                }
                                if (c == 3 && direccion_test != "DIRECCION")
                                {
                                    List<AuditoriaIntelectual> listaDireccion5 = negocioSC.ListaDireccion(jefedirecto);
                                    jefedirecto = listaDireccion5[0].CveJefeDirecto.ToString();
                                    nombrejefedirecto = listaDireccion5[0].Nombre.ToString();
                                    direccion = listaDireccion5[0].Departamento.ToString();
                                }
                                c = c + 1;
                            }
                        }
                    }
                    lbDireccion.Text = direccion;

                }

                string totalempleados = "0";
                List<AuditoriaIntelectual> listaEmpleosOldEBS = negocioSC.ListaEmpleosAnteriores(noempleado);

                string empleopuestoanterior = "";
                string empleopuestoanterior1 = "";
                string empleopuestoanterior2 = "";
                string empleopuestoanterior3 = "";

                //string totalempleados = listaEmpleosOldEBS.Count.ToString();
                if (listaEmpleosOldEBS == null)
                {
                    totalempleados = "0";
                    lbEmpleo1.Text = "--";
                    lbEmpleo2.Text = "--";
                    lbEmpleo3.Text = "--";
                    lbEmpleo4.Text = "--";
                }
                else
                {
                    totalempleados = listaEmpleosOldEBS.Count.ToString();

                    if (totalempleados == "1")
                    {
                        empleopuestoanterior = listaEmpleosOldEBS[0].EmpleoAnteriorPuesto.ToString();
                        lbEmpleo1.Text = listaEmpleosOldEBS[0].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior + " \n Fecha Inicio/ Fin: " + listaEmpleosOldEBS[0].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[0].FechaFinJobAnt.ToString();
                        lbEmpleo2.Text = "--";
                    }

                    if (totalempleados == "2")
                    {
                        empleopuestoanterior = listaEmpleosOldEBS[0].EmpleoAnteriorPuesto.ToString();
                        empleopuestoanterior1 = listaEmpleosOldEBS[1].EmpleoAnteriorPuesto.ToString();
                        lbEmpleo1.Text = listaEmpleosOldEBS[0].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior + " \nFecha Inicio/Fin: " + listaEmpleosOldEBS[0].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[0].FechaFinJobAnt.ToString();
                        lbEmpleo2.Text = listaEmpleosOldEBS[1].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior1 + " \nFecha Inicio/Fin: " + listaEmpleosOldEBS[1].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[1].FechaFinJobAnt.ToString();
                        lbEmpleo3.Text = "--";
                    }

                    if (totalempleados == "3" || Convert.ToInt16(totalempleados) >= 3)
                    {
                        empleopuestoanterior = listaEmpleosOldEBS[0].EmpleoAnteriorPuesto.ToString();
                        empleopuestoanterior1 = listaEmpleosOldEBS[1].EmpleoAnteriorPuesto.ToString();
                        empleopuestoanterior2 = listaEmpleosOldEBS[2].EmpleoAnteriorPuesto.ToString();
                        lbEmpleo1.Text = listaEmpleosOldEBS[0].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior + "  \nFecha Inicio/Fin: " + listaEmpleosOldEBS[0].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[0].FechaFinJobAnt.ToString();
                        lbEmpleo2.Text = listaEmpleosOldEBS[1].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior1 + " \nFecha Inicio/Fin: " + listaEmpleosOldEBS[1].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[1].FechaFinJobAnt.ToString();
                        lbEmpleo3.Text = listaEmpleosOldEBS[2].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior2 + " \nFecha Inicio/Fin: " + listaEmpleosOldEBS[2].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[2].FechaFinJobAnt.ToString();
                    }
                    if (totalempleados == "4" || Convert.ToInt16(totalempleados) >= 4)
                    {
                        empleopuestoanterior = listaEmpleosOldEBS[0].EmpleoAnteriorPuesto.ToString();
                        empleopuestoanterior1 = listaEmpleosOldEBS[1].EmpleoAnteriorPuesto.ToString();
                        empleopuestoanterior2 = listaEmpleosOldEBS[2].EmpleoAnteriorPuesto.ToString();
                        empleopuestoanterior3 = listaEmpleosOldEBS[3].EmpleoAnteriorPuesto.ToString();
                        lbEmpleo1.Text = listaEmpleosOldEBS[0].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior + "  \nFecha Inicio/Fin: " + listaEmpleosOldEBS[0].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[0].FechaFinJobAnt.ToString();
                        lbEmpleo2.Text = listaEmpleosOldEBS[1].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior1 + " \nFecha Inicio/Fin: " + listaEmpleosOldEBS[1].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[1].FechaFinJobAnt.ToString();
                        lbEmpleo3.Text = listaEmpleosOldEBS[2].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior2 + " \nFecha Inicio/Fin: " + listaEmpleosOldEBS[2].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[2].FechaFinJobAnt.ToString();
                        lbEmpleo4.Text = listaEmpleosOldEBS[3].EmpleoAnterior.ToString() + " \nPuesto:  " + empleopuestoanterior3 + " \nFecha Inicio/Fin: " + listaEmpleosOldEBS[3].FechaIniJobAnt.ToString() + " - " + listaEmpleosOldEBS[3].FechaFinJobAnt.ToString();
                    }
                }

                //------------------------------------------------------------------------PARA LOS CURSOS
                string total_cursos = "0";
                using (SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["conexionAPPS"].ToString()))
                {
                    cnx.Open();
                    string query = " SELECT   count(c.descripcion_curso) as totalcursos  " +
                                   " FROM     AUD_C_CURSOS as c, AUD_D_CAPACITACION as d   " +
                                   " WHERE   d.id_curso= c.id_curso and (d.id_empleado= '" + noempleado + "') ";
                    SqlCommand cmd = new SqlCommand(query, cnx);
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            total_cursos = dr["totalcursos"].ToString();
                        }
                    }
                }

                using (SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["conexionAPPS"].ToString()))
                {
                    int cc = 0;
                    cnx.Open();
                    string query = " SELECT   c.descripcion_curso, d.id_proveedor_jde as idpro, " +
                                   "          d.modalidad_cap, d.lugar_cap, CONVERT(VARCHAR(10), d.fecha_inicio_cap, 103) as fecha_inicio_cap, " +
                                   "          CONVERT(VARCHAR(10), d.fecha_fin_cap, 103) as fecha_fin_cap, d.costo_cap, " +
                                   "          d.area_ebs_cap, d.moneda_cap, d.id_curso, d.id_empleado , d.doc_id " +
                                   " FROM     AUD_C_CURSOS as c, AUD_D_CAPACITACION as d  " +
                                   " WHERE    d.id_curso= c.id_curso and (d.id_empleado= '" + noempleado + "')  " +
                                   " order by fecha_inicio_cap ";
                    SqlCommand cmd = new SqlCommand(query, cnx);
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {

                            string descripcion_curso = dr["descripcion_curso"].ToString();
                            string FechaInicio = dr["fecha_inicio_cap"].ToString();
                            string FechaFin = dr["fecha_fin_cap"].ToString();
                            cc += 1;
                            if (cc == 1)
                            {
                                lbCursosAnt.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 2)
                            {
                                lbCurso1.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 3)
                            {
                                lbCurso2.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 4)
                            {
                                lbCurso3.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 5)
                            {
                                lbCurso4.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 6)
                            {
                                lbCurso5.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 7)
                            {
                                lbCurso6.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 8)
                            {
                                lbCurso7.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 9)
                            {
                                lbCurso8.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 10)
                            {
                                lbCurso9.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                            if (cc == 11)
                            {
                                lbCurso10.Text = descripcion_curso + " \nFecha Inicio: " + FechaInicio + " - " + FechaFin;
                            }
                        }
                    }
                }

             //------------------------------------------------------------------------------------para sacar si tiene visa

                using (SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["conexionAPPS"].ToString()))
                {
                    int ccvisa = 0;
                    cnx.Open();
                    string query = " SELECT doc_IdEmpleado, doc_agrupador, doc_tipo, doc_nombre , doc_subtipo,  " +
                                   " CONVERT(VARCHAR(10), doc_fecha_ini_vig, 103) as inivig,  CONVERT(VARCHAR(10), doc_fecha_fin_vig, 103) as finvig  " +
                                   " FROM AUD_EXPEDIENTE " +
                                   " WHERE doc_IdEmpleado ='" + noempleado + "' and RTRIM(doc_subtipo) like 'VISA%' ";

                    SqlCommand cmd = new SqlCommand(query, cnx);
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {

                            string visa = dr["doc_subtipo"].ToString();
                            string fechainivig = dr["inivig"].ToString();
                            string fechafinvig = dr["finvig"].ToString();

                            if (fechainivig == null)
                            {
                                fechainivig = "-";
                            }

                            if (fechafinvig == null)
                            {
                                fechafinvig = "-";
                            }


                            ccvisa += 1;
                            if (ccvisa == 1)
                            {
                                lbVisa.Text = visa + " Fecha Vigencia: " + fechainivig + " - " + fechafinvig;
                            }
                            if (ccvisa == 2)
                            {
                                lbVisa2.Text = visa + " Fecha Vigencia: " + fechainivig + " - " + fechafinvig;
                            }
                            if (ccvisa == 3)
                            {
                                lbVisa3.Text = visa + " Fecha Vigencia: " + fechainivig + " - " + fechafinvig;
                            }
                            if (ccvisa == 4)
                            {
                                lbVisa4.Text = visa + " Fecha Vigencia: " + fechainivig + " - " + fechafinvig;
                            }
                            if (ccvisa == 5)
                            {
                                lbVisa5.Text = visa + " Fecha Vigencia: " + fechainivig + " - " + fechafinvig;
                            }
                            if (ccvisa == 6)
                            {
                                lbVisa6.Text = visa + " Fecha Vigencia: " + fechainivig + " - " + fechafinvig;
                            }

                        }
                    }
                }


                //------------------------------------------------------------------------para sacar la evaluacion
                //para buscar la ultima calificacion de evaluacion
                List<EntidadCalificacionEva> listaEva = negocioEva.ListaPlantilla();
                if (listaEva == null)
                {
                    //MensajeErrorFiltros(negocioEva.Log + "/ O no se encuentra la plantilla Actualizada");
                    //panel1.Visible = false;
                    return;
                }
                else
                {
                    lbPlantilla.Text = listaEva[0].PlantillaEva.ToString();
                }

                //para sacar puntaje de Indicadores
                EntidadCalificacionEva entidadEvaluacion = new EntidadCalificacionEva();

                entidadEvaluacion.PlantillaEva = lbPlantilla.Text;
                entidadEvaluacion.NoEmpleado = noempleado;

                NegocioPlantillaEva negocioEvalaucion = new NegocioPlantillaEva();
                DataTable DgPuntajeIndicadores = negocioEvalaucion.BuscarPuntajeInd(entidadEvaluacion, entidadEvaluacion);
                if (DgPuntajeIndicadores != null)
                {
                    if (DgPuntajeIndicadores.Rows.Count != 0)
                    {
                        foreach (DataRow fila in DgPuntajeIndicadores.Rows)
                        {
                            noemp.Text = fila["no_emp"].ToString();
                            evaid.Text = fila["evaluacion"].ToString();
                            calindicador.Text = fila["totalpuntaje"].ToString();
                        }
                    }
                }
                //para sacar el puntaje en seccion valores de la evaluacion de desempeño
                EntidadCalificacionEva entidadPuntajeVal = new EntidadCalificacionEva();
                entidadPuntajeVal.Evaluacion = evaid.Text;
                entidadPuntajeVal.PlantillaEva = lbPlantilla.Text;
                DataTable DgPuntajeValores = negocioEvalaucion.BuscarPuntajeVal(entidadPuntajeVal, entidadPuntajeVal);
                if (DgPuntajeValores != null)
                {
                    if (DgPuntajeValores.Rows.Count != 0)
                    {
                        foreach (DataRow filaval in DgPuntajeValores.Rows)
                        {
                            lbCalval.Text = filaval["total_puntaje_val"].ToString();
                        }
                    }
                }

                //para obtener el valor general de la evaluacion con calificacion de Indicadores 
                EntidadCalificacionEva entidadPuntajeGral = new EntidadCalificacionEva();
                entidadPuntajeGral.CalificacionInd = calindicador.Text;
                DataTable DgPuntajeIndicadoresLetra = negocioEvalaucion.BuscarPuntajeGeneral(entidadPuntajeGral);
                if (DgPuntajeIndicadoresLetra != null)
                {
                    if (DgPuntajeIndicadoresLetra.Rows.Count != 0)
                    {
                        foreach (DataRow filaval in DgPuntajeIndicadoresLetra.Rows)
                        {
                            lbCalificacionkpi.Text = filaval["calificacion_kpi"].ToString();
                            desc_calind.Text = filaval["descripcion_kpi"].ToString().ToUpper();
                        }
                    }
                }

                //para obtener la descripcion de los valores del puntaje obtenido 
                EntidadCalificacionEva entidadCalValores = new EntidadCalificacionEva();
                entidadCalValores.CalificacionVal = lbCalval.Text;
                DataTable DgPuntajeValoresLetra = negocioEvalaucion.BuscarDescCalValores(entidadCalValores);
                if (DgPuntajeValoresLetra != null)
                {
                    if (DgPuntajeValoresLetra.Rows.Count != 0)
                    {
                        foreach (DataRow filaval in DgPuntajeValoresLetra.Rows)
                        {
                            lbDescval.Text = filaval["descripcion_pondera"].ToString();
                        }
                    }
                }

                if (lbCalval.Text != "" && lbCalificacionkpi.Text != "")
                {
                    //para sacar el resultado general de la evaluacion

                    //================================PARA SACAR RESULTADO DE LA CALIFICION GRAL============
                    if ((Convert.ToInt32(lbCalval.Text.Trim()) >= 17) && ((Convert.ToInt32(lbCalval.Text.Trim())) <= 22))
                    {
                        if (lbCalificacionkpi.Text == "A" || lbCalificacionkpi.Text == "B")
                        {
                            calificacion_total.Text = "CRITICO";
                        }
                        if (lbCalificacionkpi.Text == "C-" || lbCalificacionkpi.Text == "C")
                        {
                            calificacion_total.Text = "NECESITA CAPACITAR/ENTRENAR";
                        }
                        if (lbCalificacionkpi.Text == "C+" || lbCalificacionkpi.Text == "D")
                        {
                            calificacion_total.Text = "NECESITA CAPACITAR/ENTRENAR";
                        }
                    }
                    else
                    {
                        if ((Convert.ToInt32(lbCalval.Text.Trim()) >= 23) && (Convert.ToInt32(lbCalval.Text.Trim()) <= 45))
                        {
                            if (lbCalificacionkpi.Text.Trim() == "A" || lbCalificacionkpi.Text.Trim() == "B")
                            {
                                calificacion_total.Text = "NECESITA CAPACITAR/ENTRENAR";
                            }
                            if (lbCalificacionkpi.Text.Trim() == "C-" || lbCalificacionkpi.Text.Trim() == "C")
                            {
                                calificacion_total.Text = "RECONOCER Y DESARROLLAR";
                            }
                            if (lbCalificacionkpi.Text.Trim() == "C+" || lbCalificacionkpi.Text.Trim() == "D")
                            {
                                calificacion_total.Text = "RECONOCER Y DESARROLLAR";
                            }
                        }
                        else
                        {
                            if ((Convert.ToInt32(lbCalval.Text) >= 45) && (Convert.ToInt32(lbCalval.Text.Trim()) <= 54))
                            {
                                if (lbCalificacionkpi.Text.Trim() == "A" || lbCalificacionkpi.Text.Trim() == "B")
                                {
                                    calificacion_total.Text = "NECESITA CAPACITAR/ENTRENAR";
                                }
                                if (lbCalificacionkpi.Text.Trim() == "C-" || lbCalificacionkpi.Text.Trim() == "C")
                                {
                                    calificacion_total.Text = "RECONOCER Y DESARROLLAR";
                                }
                                if (lbCalificacionkpi.Text.Trim() == "C+" || lbCalificacionkpi.Text.Trim() == "D")
                                {
                                    calificacion_total.Text = "RETENER";
                                }
                            }
                        }
                    }
                }
                //====PARA SACAR LAS ANTERIORES EVALUACION (old) ===========================================================================================================================

                //------------------------------------------------------------------------para sacar la evaluacion
                //para buscar las evaluaciones
                string id_plantilla = "0";
                using (SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["conexionAPPS"].ToString()))
                {
                    cnx.Open();
                    string query = " SELECT id_plantilla FROM EVA_PLANTILLAS WHERE (vigencia_plant <> '1')   ";
                    SqlCommand cmd = new SqlCommand(query, cnx);
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            id_plantilla = dr["id_plantilla"].ToString();
                            lbPlantilla2.Text = id_plantilla;
                        }
                    }
                }



                //para sacar puntaje de Indicadores
                EntidadCalificacionEva entidadEvaluacion2 = new EntidadCalificacionEva();

                entidadEvaluacion2.PlantillaEva = lbPlantilla2.Text;
                entidadEvaluacion2.NoEmpleado = noempleado;

                NegocioPlantillaEva negocioEvalaucion2 = new NegocioPlantillaEva();
                DataTable DgPuntajeIndicadores2 = negocioEvalaucion2.BuscarPuntajeInd(entidadEvaluacion2, entidadEvaluacion2);
                if (DgPuntajeIndicadores2 != null)
                {
                    if (DgPuntajeIndicadores2.Rows.Count != 0)
                    {
                        foreach (DataRow fila in DgPuntajeIndicadores2.Rows)
                        {
                            noemp2.Text = fila["no_emp"].ToString();
                            evaid2.Text = fila["evaluacion"].ToString();
                            calindicador2.Text = fila["totalpuntaje"].ToString();
                        }
                    }
                }
                //para sacar el puntaje en seccion valores de la evaluacion de desempeño
                EntidadCalificacionEva entidadPuntajeVal2 = new EntidadCalificacionEva();
                entidadPuntajeVal2.Evaluacion = evaid2.Text;
                entidadPuntajeVal2.PlantillaEva = id_plantilla;
                DataTable DgPuntajeValores2 = negocioEvalaucion2.BuscarPuntajeVal(entidadPuntajeVal2, entidadPuntajeVal2);
                if (DgPuntajeValores2 != null)
                {
                    if (DgPuntajeValores2.Rows.Count != 0)
                    {
                        foreach (DataRow filaval in DgPuntajeValores2.Rows)
                        {
                            lbCalval2.Text = filaval["total_puntaje_val"].ToString();
                        }
                    }
                }

                //para obtener el valor general de la evaluacion con calificacion de Indicadores 
                EntidadCalificacionEva entidadPuntajeGral2 = new EntidadCalificacionEva();
                entidadPuntajeGral2.CalificacionInd = calindicador.Text;
                DataTable DgPuntajeIndicadoresLetra2 = negocioEvalaucion2.BuscarPuntajeGeneral(entidadPuntajeGral2);
                if (DgPuntajeIndicadoresLetra2 != null)
                {
                    if (DgPuntajeIndicadoresLetra2.Rows.Count != 0)
                    {
                        foreach (DataRow filaval in DgPuntajeIndicadoresLetra2.Rows)
                        {
                            lbCalificacionkpi2.Text = filaval["calificacion_kpi"].ToString();
                            desc_calind2.Text = filaval["descripcion_kpi"].ToString().ToUpper();
                        }
                    }
                }

                //para obtener la descripcion de los valores del puntaje obtenido 
                EntidadCalificacionEva entidadCalValores2 = new EntidadCalificacionEva();
                entidadCalValores2.CalificacionVal = lbCalval.Text;
                DataTable DgPuntajeValoresLetra2 = negocioEvalaucion2.BuscarDescCalValores(entidadCalValores2);
                if (DgPuntajeValoresLetra2 != null)
                {
                    if (DgPuntajeValoresLetra2.Rows.Count != 0)
                    {
                        foreach (DataRow filaval in DgPuntajeValoresLetra2.Rows)
                        {
                            lbDescval2.Text = filaval["descripcion_pondera"].ToString();
                        }
                    }
                }

                if (lbCalval2.Text != "" && lbCalificacionkpi2.Text != "")
                {
                    //para sacar el resultado general de la evaluacion

                    //================================PARA SACAR RESULTADO DE LA CALIFICION GRAL============
                    if ((Convert.ToInt32(lbCalval2.Text.Trim()) >= 17) && ((Convert.ToInt32(lbCalval2.Text.Trim())) <= 22))
                    {
                        if (lbCalificacionkpi2.Text == "A" || lbCalificacionkpi2.Text == "B")
                        {
                            calificacion_total2.Text = "CRITICO";
                        }
                        if (lbCalificacionkpi2.Text == "C-" || lbCalificacionkpi2.Text == "C")
                        {
                            calificacion_total2.Text = "NECESITA CAPACITAR/ENTRENAR";
                        }
                        if (lbCalificacionkpi2.Text == "C+" || lbCalificacionkpi2.Text == "D")
                        {
                            calificacion_total2.Text = "NECESITA CAPACITAR/ENTRENAR";
                        }
                    }
                    else
                    {
                        if ((Convert.ToInt32(lbCalval2.Text.Trim()) >= 23) && (Convert.ToInt32(lbCalval2.Text.Trim()) <= 45))
                        {
                            if (lbCalificacionkpi2.Text.Trim() == "A" || lbCalificacionkpi2.Text.Trim() == "B")
                            {
                                calificacion_total2.Text = "NECESITA CAPACITAR/ENTRENAR";
                            }
                            if (lbCalificacionkpi2.Text.Trim() == "C-" || lbCalificacionkpi2.Text.Trim() == "C")
                            {
                                calificacion_total2.Text = "RECONOCER Y DESARROLLAR";
                            }
                            if (lbCalificacionkpi2.Text.Trim() == "C+" || lbCalificacionkpi2.Text.Trim() == "D")
                            {
                                calificacion_total2.Text = "RECONOCER Y DESARROLLAR";
                            }
                        }
                        else
                        {
                            if ((Convert.ToInt32(lbCalval2.Text) >= 45) && (Convert.ToInt32(lbCalval2.Text.Trim()) <= 54))
                            {
                                if (lbCalificacionkpi2.Text.Trim() == "A" || lbCalificacionkpi2.Text.Trim() == "B")
                                {
                                    calificacion_total2.Text = "NECESITA CAPACITAR/ENTRENAR";
                                }
                                if (lbCalificacionkpi2.Text.Trim() == "C-" || lbCalificacionkpi2.Text.Trim() == "C")
                                {
                                    calificacion_total2.Text = "RECONOCER Y DESARROLLAR";
                                }
                                if (lbCalificacionkpi2.Text.Trim() == "C+" || lbCalificacionkpi2.Text.Trim() == "D")
                                {
                                    calificacion_total2.Text = "RETENER";
                                }
                            }
                        }
                    }
                }

                //===========================================================================================================================

                //para sacar el permiso para el mostrar el salario
                using (SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["conexionAPPS"].ToString()))
                {
                    cnx.Open();
                    string query = " SELECT      COUNT(per_usuario) AS totaluser " +
                                   " FROM         SYS_PER_MENUS " +
                                   " WHERE     (per_menu = '7') AND (per_usuario = '" + Session["Username"] + "') ";
                    SqlCommand cmd = new SqlCommand(query, cnx);
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            total_user = dr["totaluser"].ToString();
                        }
                    }
                }
                //----------------------------------------------------------------------------------------------------
                //para sacar la foto

                string nombrecompletofoto = "";
                string nombrecompletoemp = "";

                List<AuditoriaIntelectual> listaEmpEBS_F = negocioSC.ListaEmpleadosAI(noempleado, "%", "%", "%", "%", "%", "%", "%", "%");

                if (listaEmpEBS_F != null)
                {
                    nombrecompletofoto = listaEmpEBS_F[0].Nombre.ToString();
                    string[] parts = nombrecompletofoto.Split(' ');
                    string apellido_pat = parts[0];
                    string apellido_mat = parts[1];
                    string primer_nombre = parts[2];
                    // para separar apellidos para no renombrar las imagenes de rh

                    string segundo_nombre = "";
                    string tercero_nombre = "";

                    int totalarray = parts.Length;

                    if (totalarray <= 3)
                    {
                        nombrecompletoemp = primer_nombre + "_" + apellido_pat + "_" + apellido_mat;
                    }

                    if (totalarray > 3)
                    {
                        segundo_nombre = parts[3];
                        nombrecompletoemp = primer_nombre + "_" + segundo_nombre + "_" + apellido_pat + "_" + apellido_mat;
                    }

                    if (totalarray > 4)
                    {
                        tercero_nombre = parts[4];
                        nombrecompletoemp = primer_nombre + "_" + segundo_nombre + "_" + tercero_nombre + "_" + apellido_pat + "_" + apellido_mat;
                    }

                }
                else
                {
                    nombrecompletofoto = "";
                    nombrecompletoemp = "";
                }

                //NUEVA RUTA SERVER
                string rutaimagen_fisicaperfil = HttpContext.Current.Server.MapPath("/Expedientes/images/user_foto/") + nombrecompletoemp + ".jpg";
                string rutaimagenperfil = "~/Expedientes/images/user_foto/" + nombrecompletoemp + ".jpg";

                // si existe la foto
                //if (System.IO.File.Exists(rutaimagenperfil))
                //{
                //    //urlimagen.Text = rutaimagenperfil;
                //    urlimagen.Text = nombrecompletoemp + ".jpg";
                //}
                //else
                //{
                //    urlimagen.Text = "images2.jpg";
                //}
                urlimagen.Text = nombrecompletoemp + ".jpg";
                string YourPath = Server.MapPath(@"~/Expedientes/images/user_foto/" + nombrecompletoemp + ".jpg");
                if (File.Exists(YourPath))
                {
                    urlimagen.Text = nombrecompletoemp + ".jpg";
                }
                else
                {
                    urlimagen.Text = "images2.jpg";
                }
                ExportarPDF();
            }
        }
예제 #8
0
        protected void ctrBuscar_Click(object sender, EventArgs e)
        {
            string vigenciaini ="";
            string vigenciafin ="";
            Digitalizaciones entidadDigitlizacionesSC = new Digitalizaciones();
            string NombreArchivo = "";
            string nombreempleado = "";
            string RutArchivo = "";
            string nomtxt = "";
            string yourDirectory = "";
            string nombrecurso = "";
            string ultimoidcurso = "";
            string Agrupacion = "";
            string FechaIniVig = "";
            string FechaFinVig = "";
            //string docnombre = "";
            string totalarchivos = "";
            string anexo="";

            //para sacar el nombre del empleado 
            //DEVUELVE LOS VALORES DEL EBS
            this.capitalHumano = new NegocioCapitalHumano();
            List<Employee> listaEmpleados = capitalHumano.ListaEmpleados2(idempleado, "%", "%", "%", "%", "%", "%", "%", "%", "%", "%", Convert.ToDateTime("01/Jan/1950"), Convert.ToDateTime("01/Jan/9999"));

            //----para validar que no venga vacio los datos y marque error
            if (listaEmpleados == null)
            {
                lbstatus.Text = "No se encontro el Nombre Completo";
                return;
            }
            else
            {
                lbnombre.Text = listaEmpleados[0].NombreCompleto.ToString();
            }

            Boolean fileOK = false;
            if (fupCargarDigitalizacion.HasFile)
            {
                String fileExtension = System.IO.Path.GetExtension(fupCargarDigitalizacion.FileName).ToLower();
                String[] allowedExtensions = { ".pdf" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        fileOK = true;
                    }
                }
            }

            if (fileOK)
            {
                try
                {
                    //upload logic
                    Response.Write(fupCargarDigitalizacion.FileName + " - " + fupCargarDigitalizacion.PostedFile.ContentLength + " Bytes. <br>");
                    //foreach (HttpPostedFile htfiles in fupCargarDigitalizacion.PostedFiles)
                    //{
                    //    getFileName = Path.GetFileName(htfiles.FileName);
                    //    htfiles.SaveAs(Server.MapPath("~/UploadedFiles/" + getFileName));
                    //}

                    //HttpFileCollection multipleFiles = Request.Files;
                    //for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
                    //{
                    //    HttpPostedFile uploadedFile = multipleFiles[fileCount];
                    //    string fileName = Path.GetFileName(uploadedFile.FileName);
                    //    if (uploadedFile.ContentLength > 0)
                    //    {
                    //        uploadedFile.SaveAs(Server.MapPath("~/Files/") + fileName);
                    //    }
                    //}

                    RutArchivo = "Expedientes/";
                    //nombre con guion sobre los espacios
                    nomtxt = lbnombre.Text;
                    nombreempleado = lbnombre.Text.Replace(" ", "_");
                    //para sacar el idcurso
                    string connectionString = ConfigurationManager.ConnectionStrings["conexionAPPS"].ConnectionString;
                    using (SqlConnection cnx = new SqlConnection(connectionString))
                    {
                        cnx.Open();
                        string query = "select * from AUD_C_CURSOS where id_curso= '" + idcurso + "' ";
                        SqlCommand cmd = new SqlCommand(query, cnx);
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {
                                nombrecurso = dr["descripcion_curso"].ToString();
                            }
                        }
                        else
                        {
                            nombrecurso = idcurso;  //sino existe pongo el numero de id del curso
                        }
                    }   // cierre de la conn
                    using (SqlConnection cnx = new SqlConnection(connectionString))
                    {
                        cnx.Open();
                        string query = "SELECT max(doc_id) as ultimoidcurso FROM AUD_D_CAPACITACION ";
                        SqlCommand cmd = new SqlCommand(query, cnx);
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {
                                ultimoidcurso = dr["ultimoidcurso"].ToString();
                            }
                        }
                        else
                        {
                            ultimoidcurso = "0";  //sino existe pongo el numero de id del curso
                        }
                    }   // cierre de la conn

                    //====================================AQUI VAN LOS DATOS A GUARDAR================================
                    HttpFileCollection uploadedFiles = Request.Files;
                    for (int i = 0; i < uploadedFiles.Count; i++)
                    {
                        HttpPostedFile userPostedFile = uploadedFiles[i];
                        try
                        {  //recorre el upload tanto archivos se hayam subido
                            if (userPostedFile.ContentLength > 0)
                            {
                                Label1.Text += "<br><u>File #" + (i + 1) + "</u><br>";
                                Label1.Text += "File Content Type: " + userPostedFile.ContentType + "<br>";
                                Label1.Text += "File Size: " + userPostedFile.ContentLength + "kb<br>";
                                Label1.Text += "File Name: " + userPostedFile.FileName + "<br>";

                                // ---AQUI DEBE IR TODO LO LOS DATOS QUE SE VAYAN A GUARDAR RUTA Y NOMBRE DEL LOS ARCHIVOS EN AUD EXPEDIENTE
                                //==============================busco los demas datos para buscar sus cursos
                                using (SqlConnection cnx = new SqlConnection(connectionString))
                                {
                                    cnx.Open();
                                    string query = " SELECT COUNT(doc_IdArchivo) as totalarchivos " +
                                                   " FROM AUD_EXPEDIENTE " +
                                                   " WHERE (doc_id_curso = '" + idcurso + "') AND (doc_IdEmpleado = '" + idempleado + "') " +
                                                   " order by 1 ";

                                    SqlCommand cmd = new SqlCommand(query, cnx);
                                    SqlDataReader dr = cmd.ExecuteReader();
                                    if (dr.HasRows)
                                    {
                                        while (dr.Read())
                                        {
                                            totalarchivos = dr["totalarchivos"].ToString();
                                        }
                                    }
                                    else
                                    {
                                        totalarchivos = "0";  //sino existe
                                    }
                                }   // cierre de la conn

                                if (totalarchivos == "1")
                                {
                                    anexo = "Parte2";
                                }
                                if (totalarchivos == "2")
                                {
                                    anexo = "Parte3";
                                }
                                if (totalarchivos == "3")
                                {
                                    anexo = "Parte4";
                                }
                                if (totalarchivos == "4")
                                {
                                    anexo = "Parte5";
                                }
                                if (totalarchivos == "5")
                                {
                                    anexo = "Parte6";
                                }
                                if (totalarchivos == "6")
                                {
                                    anexo = "Parte7";
                                }
                                if (totalarchivos == "7")
                                {
                                    anexo = "Parte8";
                                }
                                if (totalarchivos == "8")
                                {
                                    anexo = "Parte9";
                                }
                                if (totalarchivos == "9")
                                {
                                    anexo = "Parte10";
                                }
                                if (totalarchivos == "10")
                                {
                                    anexo = "Parte11";
                                }
                                if (Convert.ToInt32(totalarchivos) > 11) {
                                    Label1.Text += "Solo puedes subir maximo 10";
                                    return;
                                }
                               
   //____________________________________________________________________________________

                                //directorio donde se guardara el archivo 
                                if (totalarchivos == "0")
                                {
                                    string rutaserver = HttpContext.Current.Server.MapPath("/Expedientes/");
                                    NombreArchivo = rutaserver + nomtxt + "\\" + nombrecurso + "_" + nombreempleado + "_" + idempleado + ".pdf";
                                    entidadDigitlizacionesSC.NombreArchivo = nombrecurso + "_" + nombreempleado + "_" + idempleado + ".pdf";
                                }
                                else
                                {
                                    string rutaserver = HttpContext.Current.Server.MapPath("/Expedientes/");
                                    NombreArchivo = rutaserver + nomtxt + "\\" + nombrecurso + "-" + nombreempleado + "_" + idempleado + "_" + anexo + ".pdf";
                                    entidadDigitlizacionesSC.NombreArchivo = nombrecurso + "-" + nombreempleado + "_" + idempleado + "_" + anexo + ".pdf";
                                }
                                string rutaserver2 = HttpContext.Current.Server.MapPath("/Expedientes/");
                                //yourDirectory = "C:\\Users\\Public\\Documents\\APPS\\APPS\\Apps\\Documentos\\Expedientes\\" + nomtxt + "\\";
                                yourDirectory = rutaserver2 + nomtxt + "\\";
                                // para validar que exista el directorio donde se va guardar el archivo 
                                if (!Directory.Exists(yourDirectory))
                                {
                                    Directory.CreateDirectory(yourDirectory);
                                    //fupCargarDigitalizacion.PostedFile.SaveAs(NombreArchivo);
                                    userPostedFile.SaveAs(NombreArchivo);
                                    lbstatus.Text = "  Estado: Archivo subido! ";
                                }
                                else
                                {
                                    //fupCargarDigitalizacion.PostedFile.SaveAs(NombreArchivo);
                                    userPostedFile.SaveAs(NombreArchivo);
                                    lbstatus.Text = "   Estado: Archivo subido! ";
                                }
                                                             
   //_________________________________________________________________________________________________________________


                                //busco los demas datos
                                using (SqlConnection cnx = new SqlConnection(connectionString))
                                {
                                    cnx.Open();
                                    string query = " SELECT  doc_IdArchivo, doc_nombre, doc_ruta, doc_IdEmpleado, doc_tipo, doc_subtipo, " +
                                                   "         doc_agrupador, doc_Mes, doc_anio, doc_descripcion, doc_alta, doc_user, " +
                                                   "         doc_id_curso, doc_id_capacitacion, doc_fecha_ini_vig, doc_fecha_fin_vig " +
                                                   " FROM    AUD_EXPEDIENTE " +
                                                   " WHERE   (doc_id_curso = '" + idcurso + "') AND (doc_IdEmpleado = '" + idempleado + "')";

                                    SqlCommand cmd = new SqlCommand(query, cnx);
                                    SqlDataReader dr = cmd.ExecuteReader();
                                    if (dr.HasRows)
                                    {
                                        while (dr.Read())
                                        {
                                            Agrupacion = dr["doc_agrupador"].ToString();
                                            FechaIniVig = dr["doc_fecha_ini_vig"].ToString();
                                            FechaFinVig = dr["doc_fecha_fin_vig"].ToString();
                                        }
                                    }
                                    else
                                    {
                                        ultimoidcurso = "0";  //sino existe pongo el numero de id del curso
                                    }
                                }   // cierre de la conn
                                //para cambiar el formato de fechas
                                if (!string.IsNullOrEmpty(FechaIniVig))
                                {
                                    vigenciafin = FechaIniVig; // ejemplo 30/05/2014 09:00:0
                                    string[] parts = vigenciafin.Split('/');
                                    string anio = parts[2];
                                    string[] parts2 = anio.Split(' ');
                                    string anio2 = parts2[0];
                                    string mes = parts[1];
                                    string dia = parts[0];
                                    entidadDigitlizacionesSC.FechaIniVig = dia + "/" + mes + "/" + anio2;
                                }
                                else
                                {
                                    entidadDigitlizacionesSC.FechaIniVig = "";
                                }
                                // para cambiar el formato de fecha 
                                if (!string.IsNullOrEmpty(FechaFinVig))
                                {
                                    vigenciafin = FechaFinVig; //2015-05-30
                                    string[] parts = vigenciafin.Split('/');
                                    string anio = parts[2];
                                    string[] parts2 = anio.Split(' ');
                                    string anio2 = parts2[0];
                                    string mes = parts[1];
                                    string dia = parts[0];
                                    entidadDigitlizacionesSC.FechaFinVig = dia + "/" + mes + "/" + anio2;
                                }
                                else
                                {
                                    entidadDigitlizacionesSC.FechaFinVig = "";
                                }

                                // aqui agrego los demas campos
                                entidadDigitlizacionesSC.Ubicacion = RutArchivo + lbnombre.Text + "/";
                                entidadDigitlizacionesSC.NumeroEmpleado = idempleado;
                                entidadDigitlizacionesSC.TipoDocumento = nombrecurso;
                                entidadDigitlizacionesSC.SubTipo = "CAPACITACION";
                                entidadDigitlizacionesSC.Agrupacion = Agrupacion;
                                entidadDigitlizacionesSC.Mes = DateTime.Now.ToString("MM");
                                entidadDigitlizacionesSC.Anio = DateTime.Now.Year.ToString();
                                entidadDigitlizacionesSC.IdCurso = idcurso;
                                entidadDigitlizacionesSC.IdCapacitacion = ultimoidcurso;
                                string nomusuario = (string)(Session["Nombre"]);
                                string claveusuario = (string)(Session["ClaveJDE"]);

                                if (claveusuario == null)
                                {
                                    entidadDigitlizacionesSC.Userlogin = nomusuario;
                                }
                                else
                                {
                                    entidadDigitlizacionesSC.Userlogin = claveusuario;
                                }

                                Indicadores negocioDigitalizacionesSC = new Indicadores();
                                try
                                {
                                    //para guardar las digitalizaciones si es que subio el archivo
                                    negocioDigitalizacionesSC.InsertaDigitalizaciones2(entidadDigitlizacionesSC);
                                }
                                catch (Exception Ed)
                                {
                                    //MensajeErrorFiltros("No se pudo guardar la digitalizacion, ocurrio un Error:  " + negocioDigitalizacionesSC.Log);
                                    lbstatus.Text = "No se pudo guardar la digitalizacion, ocurrio un error " + negocioDigitalizacionesSC.Log;
                                    return;
                                }
                            }
                        }
                        catch (Exception Ex)
                        {
                            Label1.Text += "Error: <br>" + Ex.Message;
                        }
                    } 
   
                }
                catch (Exception d)
                {
                    //MensajeErrorFiltros("El Archivo no se pudo subir, ocurrio un Error:  " + d);
                    lbstatus.BorderColor = Color.Red;
                    lbstatus.Text = " Estado: El Archivo no se pudo subir ";
                    lbstatus.BorderColor = Color.Red;
                    return;
                }

            }
        
        else
            {  // del if de fileOK
                lbstatus.Text = "No se puede subir este tipo de archivo solo PDF ";
                return;
            }
            //--Para actualizar la pagina padre
            string str_java = "<script language='javascript'>";
            str_java += (" window.onunload = refreshParent; ");
            str_java += (" function refreshParent() { ");
            str_java += (" window.self.location.reload(true); } ");
            str_java += (" window.close(); ");
            str_java += ("</script>");
        }
예제 #9
0
        protected void cmdAgrega_documento_Click(object sender, EventArgs e)
        {
            Digitalizaciones entidadDigitlizacionesSC = new Digitalizaciones();
            string NombreArchivo = "";
            string nombreempleado = "";
            string RutArchivo = "";
            string nomtxt = "";
            string yourDirectory ="";
            string vigencia;
            string vigenciaini;
            string vigenciafin;

            if (fupCargarDigitalizacion.HasFile)
            {
                // si existe el archivo guardar

                try
                {

                    //---------------------------------------anterior------------
                    //ULTIMO OK 30032014 PONER ESTE CUANDO SEA YA LA DEL SERVER RutArchivo = " \\\\Svr-fovrjde\\rh\\EXPEDIENTES\\EXPEDIENTES\\";
                    //NombreArchivo = "c:\\Digitalizacion\\RHU-" + txtNoEmpleado.Text.Trim() + "-" + System.IO.Path.GetFileName(fupCargarDigitalizacion.PostedFile.FileName);
                    //si funciona NombreArchivo = "\\\\Svr-fovrjde\\rh\\EXPEDIENTES\\EXPEDIENTES\\" + txtNoEmpleado.Text.Trim() + "-" + System.IO.Path.GetFileName(fupCargarDigitalizacion.PostedFile.FileName);

                    RutArchivo = "Expedientes/";

                    nomtxt = TxtEmpleado.Text;
                    //nombre con guin sobre los espacios
                    nombreempleado = nomtxt.Replace(" ", "_");

                    entidadDigitlizacionesSC.NombreArchivo = ddlSubTipoDctoExp.SelectedValue.Trim() + "-" + nombreempleado + "_" + txtNoEmpleado.Text.Trim() + ".pdf";

                    //ULTIMA OK --NombreArchivo = "\\\\Svr-fovrjde\\rh\\EXPEDIENTES\\EXPEDIENTES\\" + nomtxt + "\\" + ddlSubTipoDctoExp.SelectedValue.Trim() + "-" + nombreempleado + "_" + txtNoEmpleado.Text.Trim() + ".pdf";
                    //ULTIMO OK 30032014 PONER ESTE CUANDO SEA YA LA DEL SERVER NombreArchivo = "c:\\Digitalizacion\\" + nomtxt + "\\" + ddlSubTipoDctoExp.SelectedValue.Trim() + "-" + nombreempleado + "_" + txtNoEmpleado.Text.Trim() + ".pdf";
                    //ULTIMO OK 30032014 yourDirectory = "c:\\Digitalizacion\\" + nomtxt + "\\";

                    string rutaserver = HttpContext.Current.Server.MapPath("Expedientes/");
                    //directorio donde se guardara el archivo 
                    //NombreArchivo = "C:\\Users\\Public\\Documents\\APPS\\APPS\\Apps\\Documentos\\Expedientes\\" + nomtxt + "\\" + ddlSubTipoDctoExp.SelectedValue.Trim() + "-" + nombreempleado + "_" + txtNoEmpleado.Text.Trim() + ".pdf";
                    NombreArchivo = rutaserver + nomtxt + "\\" + ddlSubTipoDctoExp.SelectedValue.Trim() + "-" + nombreempleado + "_" + txtNoEmpleado.Text.Trim() + ".pdf";
                    //yourDirectory = "C:\\Users\\Public\\Documents\\APPS\\APPS\\Apps\\Documentos\\Expedientes\\" + nomtxt + "\\";
                    yourDirectory = rutaserver + nomtxt + "\\";
                    // para validar que exista el directorio donde se va guardar el archivo 
                    if (!Directory.Exists(yourDirectory))
                    {
                        Directory.CreateDirectory(yourDirectory);
                        fupCargarDigitalizacion.PostedFile.SaveAs(NombreArchivo);
                        StatusLabel.Text = "  Estado: Archivo subido! ";
                    }
                    else
                    {
                        fupCargarDigitalizacion.PostedFile.SaveAs(NombreArchivo);
                        StatusLabel.Text = "   Estado: Archivo subido! ";
                    }
                }
                catch (Exception d)
                {
                    MensajeErrorFiltros("El Archivo no se pudo subir, ocurrio un Error:  " + d);
                    StatusLabel.BackColor = Color.Red;
                    StatusLabel.Text = " Estado: El Archivo no se pudo subir ";
                    return;
                }

                entidadDigitlizacionesSC.Ubicacion = RutArchivo + TxtEmpleado.Text.Trim() + "/";
                entidadDigitlizacionesSC.NumeroEmpleado = txtNoEmpleado.Text.Trim();
                entidadDigitlizacionesSC.TipoDocumento = ddlSubTipoDctoExp.SelectedValue.Trim();
                entidadDigitlizacionesSC.SubTipo = "PERSONAL";
                entidadDigitlizacionesSC.Agrupacion = ddlGrupoExp.SelectedValue.Trim();
                //entidadDigitlizacionesSC.NombreArchivo = NombreArchivo;
                entidadDigitlizacionesSC.Mes = DateTime.Now.ToString("MM");
                entidadDigitlizacionesSC.Anio = DateTime.Now.Year.ToString();

                //--------------para guardar la fecha de inicio de vigencia del documento

                if (!string.IsNullOrEmpty(txtFechainivig.Text))
                {
                    vigenciaini = txtFechainivig.Text; //24/09/2015 /2015-05-30 antes
                    string[] parts = vigenciaini.Split('/');
                    string anio = parts[2];
                    string mes = parts[1];
                    string dia = parts[0];
                    entidadDigitlizacionesSC.FechaIniVig = dia + "/" + mes + "/" + anio;
                }
                else
                {
                    entidadDigitlizacionesSC.FechaIniVig = "";
                }
                //--------------para guardar la fecha de fin de vigencia del documento
                if (!string.IsNullOrEmpty(txtfechafinvig.Text))
                {
                    vigenciafin = txtfechafinvig.Text; //2015-05-30 antes //24/09/2015
                    string[] parts = vigenciafin.Split('/');
                    string anio = parts[2];
                    string mes = parts[1];
                    string dia = parts[0];
                    entidadDigitlizacionesSC.FechaFinVig = dia + "/" + mes + "/" + anio;
                }
                else
                {
                    entidadDigitlizacionesSC.FechaFinVig = "";
                }

          

                string nomusuario = (string)(Session["Nombre"]);
                string claveusuario = (string)(Session["ClaveJDE"]);

                if (claveusuario == null) 
                {
                  entidadDigitlizacionesSC.Userlogin = nomusuario;
                }
                else 
                {
                  entidadDigitlizacionesSC.Userlogin = claveusuario;
                }

                entidadDigitlizacionesSC.IdCurso = "0";
                entidadDigitlizacionesSC.IdCapacitacion = "0";
                //this.log = ex.Message;
                //_------------------------------------------------
                //-------------------NUEVO
                //RutArchivo = " \\\\Svr-fovrjde\\rh\\EXPEDIENTES\\EXPEDIENTES\\ ";
                ////NombreArchivo = "c:\\Digitalizacion\\RHU-" + txtNoEmpleado.Text.Trim() + "-" + System.IO.Path.GetFileName(fupCargarDigitalizacion.PostedFile.FileName);
                ////NombreArchivo = "\\\\Svr-fovrjde\\rh\\EXPEDIENTES\\EXPEDIENTES\\" + txtNoEmpleado.Text.Trim()  + System.IO.Path.GetFileName(fupCargarDigitalizacion.PostedFile.FileName);

                ////NombreArchivo = RutArchivo + TxtEmpleado.Text.Trim() + "\\" + ddlSubTipoDctoExp.SelectedValue.Trim() + " _ " + nombreempleado + " _" + txtNoEmpleado.Text.Trim() + ".pdf";
                //NombreArchivo = RutArchivo + txtNoEmpleado.Text.Trim() + System.IO.Path.GetFileName(fupCargarDigitalizacion.PostedFile.FileName);

                //nomtxt = TxtEmpleado.Text;
                ////nombre con guin sobre los espacios
                //nombreempleado = nomtxt.Replace(" ", "_");

                //entidadDigitlizacionesSC.NombreArchivo = ddlSubTipoDctoExp.SelectedValue.Trim() + "_" + nombreempleado + "_" + txtNoEmpleado.Text.Trim() + ".pdf";
                //fupCargarDigitalizacion.PostedFile.SaveAs(NombreArchivo);

                //entidadDigitlizacionesSC.Ubicacion = RutArchivo + TxtEmpleado.Text + "\\";
                //entidadDigitlizacionesSC.NumeroEmpleado = txtNoEmpleado.Text.Trim();
                //entidadDigitlizacionesSC.TipoDocumento = ddlSubTipoDctoExp.SelectedValue.Trim();
                //entidadDigitlizacionesSC.SubTipo = ddlTipoDctoExp.SelectedValue.Trim();
                //entidadDigitlizacionesSC.Agrupacion = ddlGrupoExp.SelectedValue.Trim();
                ////entidadDigitlizacionesSC.NombreArchivo = NombreArchivo;
                //entidadDigitlizacionesSC.Mes = DateTime.Now.ToString("MMM");
                //entidadDigitlizacionesSC.Anio = DateTime.Now.Year.ToString();
                ////this.log = ex.Message;
                //----------------------------------------------------------

                Indicadores negocioDigitalizacionesSC = new Indicadores();
                try
                {
                  negocioDigitalizacionesSC.InsertaDigitalizaciones(entidadDigitlizacionesSC);
                }
                catch (Exception d)
                {
                    
                    MensajeErrorFiltros("No se pudo guardar, ocurrio un Error:  " + negocioDigitalizacionesSC.Log);
                    return;
                }
                //----------limpia los combos
                ddlGrupoExp.SelectedIndex = 0;
                //ddlTipoDctoExp.SelectedIndex = 0;
                ddlSubTipoDctoExp.SelectedIndex = 0;
                txtFechainivig.Text = null;
                txtfechafinvig.Text = null;
                panel3.Visible = true;
                panel1.Visible = true;
                panelFiltros.CssClass = "da-panel collapsible";
                CreateGrid();
            }
            else
            {
                MensajeErrorFiltros("No has seleccionado el archivo a subir ");
                StatusLabel.BackColor = Color.Red;
                StatusLabel.Text = " Estado: El Archivo no se pudo subir ";
                return;
            }
        }
예제 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            negocioEva = new NegocioPlantillaEva();
            negocioSC = new Indicadores();

            string personid = "";
            string jefedirecto = "";
            string nombrejefedirecto = "";
            string direccion = "";
            string direccion_test = "";

            //=======================para sacar permiso menu
            String username = (string)(Session["Username"]);
            AppsEntities.usuario objUsuario = new AppsEntities.usuario();
            AppsBO.usuarioBO objusuarioBO = new AppsBO.usuarioBO();
            objUsuario.Usuario = username;
            int tienepermiso4 = objusuarioBO.tienePermisoMenu(objUsuario, 6);
            if (tienepermiso4 > 0)
            {

                string noempleado2 = Convert.ToString(Request.QueryString["id"]);
                Session["idempl"] = Convert.ToString(Request.QueryString["id"]);
                if (!Page.IsPostBack)
                {
                    negocioSC = new Indicadores();
                    string noempleado = Convert.ToString(Request.QueryString["id"]);
                    TxtEmpleado.Text = Convert.ToString(Request.QueryString["id"]);

                    List<AuditoriaIntelectual> listaEmpEBS = negocioSC.ListaEmpleadosAI(TxtEmpleado.Text, "%", "%", "%", "%", "%", "%", "%", "%");
                    if (listaEmpEBS == null)
                    {
                        //no se tiene informacionde este empleado
                    }
                    else
                    {
                        TxtEmpleado.Text = listaEmpEBS[0].Nombre.ToString();
                        lbNacionalidad.Text = listaEmpEBS[0].PaisNacimiento.ToString();
                        if (lbNacionalidad.Text == "MX")
                        {
                            lbNacionalidad.Text = "MEXICANA";
                        }

                        lbEstadoCiv.Text = listaEmpEBS[0].EstadoCivil.ToString();
                        //lbHijos.Text = listaEmpEBS[0].Nombre.ToString();
                        lbPuesto.Text = listaEmpEBS[0].Puesto.ToString();
                        lbFechaIng.Text = listaEmpEBS[0].FechaIng.ToString();
                        DateTime Hoy = DateTime.Today;
                        lbFecha.Text = Hoy.ToString("dd-MM-yyyy");
                        lbDepto.Text = listaEmpEBS[0].Departamento.ToString();
                        lbUbicacion.Text = listaEmpEBS[0].Ubicacion.ToString();
                        //lbDireccion.Text = listaEmpEBS[0].Direccion.ToString();
                        //lbSalario.Text = listaEmpEBS[0].Salario2.ToString();
                        lbCategoria.Text = listaEmpEBS[0].Categoria.ToString();
                        lbUltimoEst.Text = listaEmpEBS[0].UEstudio.ToString();
                        lbEspecialidad.Text = listaEmpEBS[0].Especialidad.ToString();
                        lbTitulo.Text = listaEmpEBS[0].GradoAcademico.ToString();
                        //lbHijos.Text = listaEmpEBS[0].Nombre.ToString();
                        //lbMaestria.Text = listaEmpEBS[0].Nombre.ToString();
                        //lbIdiomas.Text = listaEmpEBS[0].Nombre.ToString();
                        //lbEmpleo1.Text = listaEmpEBS[0].Nombre.ToString();
                        //lbEmpleo2.Text = listaEmpEBS[0].Nombre.ToString();
                        //lbEmpleo3.Text = listaEmpEBS[0].Nombre.ToString();
                        //lbCursosAnt.Text = listaEmpEBS[0].Nombre.ToString();

                        //para sacar que DIRECCION le corresponde busco por personid de sus jefe directo
                        List<AuditoriaIntelectual> listaEmpEBS3 = negocioSC.ListaEmpleadosAI(noempleado, "%","%","%","%","%","%","%","%");
                        if (listaEmpEBS3 == null)
                        {
                            //MensajeErrorFiltros(negocioEva.Log + " No se encuentra empleado con este filtro");
                            return;
                        }
                        else
                        {
                            personid = listaEmpEBS3[0].personId.ToString();
                        }
                        List<AuditoriaIntelectual> listaDireccion = negocioSC.ListaDireccion(personid);
                      
                        if (listaDireccion == null)
                        {
                            //totalempleados = "0";
                        }
                        else
                        {
                            jefedirecto = listaDireccion[0].CveJefeDirecto.ToString();
                            if (jefedirecto == string.Empty)
                            {
                                jefedirecto = listaDireccion[0].CveJefeDirecto.ToString();
                                nombrejefedirecto = listaDireccion[0].Nombre.ToString();
                                direccion = listaDireccion[0].Departamento.ToString();
                            }
                            else
                            {
                                int c = 0;
                                while (jefedirecto != string.Empty && direccion != "DIRECCION GENERAL" && c <= 4)
                                {
                                    if (direccion == "")
                                    {
                                        direccion = "-";
                                    }

                                    if (direccion.Length >= 9)
                                    {
                                        direccion_test = direccion.Substring(0, 9);
                                    }
                                    else
                                    {
                                        direccion_test = "-";
                                    }

                                    if (c == 0 && direccion_test != "DIRECCION")
                                    {
                                        List<AuditoriaIntelectual> listaDireccion2 = negocioSC.ListaDireccion(jefedirecto);
                                        jefedirecto = listaDireccion2[0].CveJefeDirecto.ToString();
                                        nombrejefedirecto = listaDireccion2[0].Nombre.ToString();
                                        direccion = listaDireccion2[0].Departamento.ToString();
                                    }
                                    if (c == 1 && direccion_test != "DIRECCION")
                                    {
                                        List<AuditoriaIntelectual> listaDireccion3 = negocioSC.ListaDireccion(jefedirecto);
                                        jefedirecto = listaDireccion3[0].CveJefeDirecto.ToString();
                                        nombrejefedirecto = listaDireccion3[0].Nombre.ToString();
                                        direccion = listaDireccion3[0].Departamento.ToString();
                                    }
                                    if (c == 2 && direccion_test != "DIRECCION")
                                    {
                                        List<AuditoriaIntelectual> listaDireccion4 = negocioSC.ListaDireccion(jefedirecto);
                                        jefedirecto = listaDireccion4[0].CveJefeDirecto.ToString();
                                        nombrejefedirecto = listaDireccion4[0].Nombre.ToString();
                                        direccion = listaDireccion4[0].Departamento.ToString();
                                    }
                                    if (c == 3 && direccion_test != "DIRECCION")
                                    {
                                        List<AuditoriaIntelectual> listaDireccion5 = negocioSC.ListaDireccion(jefedirecto);
                                        jefedirecto = listaDireccion5[0].CveJefeDirecto.ToString();
                                        nombrejefedirecto = listaDireccion5[0].Nombre.ToString();
                                        direccion = listaDireccion5[0].Departamento.ToString();
                                    }
                                    c = c + 1;
                                }
                            }
                        }
                        lbDireccion.Text = direccion;
                    }

                    string totalempleados = "0";
                    List<AuditoriaIntelectual> listaEmpleosOldEBS = negocioSC.ListaEmpleosAnteriores(noempleado);

                    string empleopuestoanterior = "";
                    string empleopuestoanterior1 = "";
                    string empleopuestoanterior2 = "";

                    //string totalempleados = listaEmpleosOldEBS.Count.ToString();
                    if (listaEmpleosOldEBS == null)
                    {
                        totalempleados = "0";
                        lbEmpleo1.Text = "--";
                        lbEmpleo2.Text = "--";
                        lbEmpleo3.Text = "--";
                    }
                    else
                    {
                        totalempleados = listaEmpleosOldEBS.Count.ToString();

                        if (totalempleados == "1")
                        {
                            empleopuestoanterior = listaEmpleosOldEBS[0].EmpleoAnteriorPuesto.ToString();
                            lbEmpleo1.Text = listaEmpleosOldEBS[0].EmpleoAnterior.ToString() + " PUESTO:  " + empleopuestoanterior + "  FECHA INICIO/FIN: " + listaEmpleosOldEBS[0].FechaIniJobAnt.ToString() + " " + listaEmpleosOldEBS[0].FechaFinJobAnt.ToString();
                            lbEmpleo2.Text = "--";
                        }

                        if (totalempleados == "2")
                        {
                            empleopuestoanterior = listaEmpleosOldEBS[0].EmpleoAnteriorPuesto.ToString();
                            empleopuestoanterior1 = listaEmpleosOldEBS[1].EmpleoAnteriorPuesto.ToString();
                            lbEmpleo1.Text = listaEmpleosOldEBS[0].EmpleoAnterior.ToString() + " PUESTO:  " + empleopuestoanterior + "  FECHA INICIO/FIN: " + listaEmpleosOldEBS[0].FechaIniJobAnt.ToString() + " " + listaEmpleosOldEBS[0].FechaFinJobAnt.ToString();
                            lbEmpleo2.Text = listaEmpleosOldEBS[1].EmpleoAnterior.ToString() + " PUESTO:  " + empleopuestoanterior1 + "  FECHA INICIO/FIN: " + listaEmpleosOldEBS[1].FechaIniJobAnt.ToString() + " " + listaEmpleosOldEBS[1].FechaFinJobAnt.ToString();
                            lbEmpleo3.Text = "--";
                        }

                        if (totalempleados == "3" || Convert.ToInt16(totalempleados) >= 3)
                        {
                            empleopuestoanterior = listaEmpleosOldEBS[0].EmpleoAnteriorPuesto.ToString();
                            empleopuestoanterior1 = listaEmpleosOldEBS[1].EmpleoAnteriorPuesto.ToString();
                            empleopuestoanterior2 = listaEmpleosOldEBS[2].EmpleoAnteriorPuesto.ToString();
                            lbEmpleo1.Text = listaEmpleosOldEBS[0].EmpleoAnterior.ToString() + " PUESTO:  " + empleopuestoanterior + "  FECHA INICIO/FIN: " + listaEmpleosOldEBS[0].FechaIniJobAnt.ToString() + " " + listaEmpleosOldEBS[0].FechaFinJobAnt.ToString();
                            lbEmpleo2.Text = listaEmpleosOldEBS[1].EmpleoAnterior.ToString() + " PUESTO:  " + empleopuestoanterior1 + "  FECHA INICIO/FIN: " + listaEmpleosOldEBS[1].FechaIniJobAnt.ToString() + " " + listaEmpleosOldEBS[1].FechaFinJobAnt.ToString();
                            lbEmpleo3.Text = listaEmpleosOldEBS[2].EmpleoAnterior.ToString() + " PUESTO:  " + empleopuestoanterior2 + "  FECHA INICIO/FIN: " + listaEmpleosOldEBS[2].FechaIniJobAnt.ToString() + " " + listaEmpleosOldEBS[2].FechaFinJobAnt.ToString();
                        }

                    }
                    //lo genero en PDF
                    //ExportarPDF();
                    //Response.Redirect("pruebapdf.aspx");
                    //------------------------------------------------------------------------PARA LOS CURSOS
                    string total_cursos = "0";
                    using (SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["conexionAPPS"].ToString()))
                    {
                        cnx.Open();
                        string query = " SELECT   count(c.descripcion_curso) as totalcursos  " +
                                       " FROM     AUD_C_CURSOS as c, AUD_D_CAPACITACION as d   " +
                                       " WHERE   d.id_curso= c.id_curso and (d.id_empleado= '" + noempleado + "') ";
                        SqlCommand cmd = new SqlCommand(query, cnx);
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {
                                total_cursos = dr["totalcursos"].ToString();
                            }
                        }
                    }

                    using (SqlConnection cnx = new SqlConnection(ConfigurationManager.ConnectionStrings["conexionAPPS"].ToString()))
                    {
                        int cc = 0;
                        cnx.Open();
                        string query = " SELECT   c.descripcion_curso, d.id_proveedor_jde as idpro, " +
                                       "          d.modalidad_cap, d.lugar_cap, CONVERT(VARCHAR(10), d.fecha_inicio_cap, 103) as fecha_inicio_cap, " +
                                       "          CONVERT(VARCHAR(10), d.fecha_fin_cap, 103) as fecha_fin_cap, d.costo_cap, " +
                                       "          d.area_ebs_cap, d.moneda_cap, d.id_curso, d.id_empleado , d.doc_id " +
                                       " FROM     AUD_C_CURSOS as c, AUD_D_CAPACITACION as d  " +
                                       " WHERE    d.id_curso= c.id_curso and (d.id_empleado= '" + noempleado + "')  ";
                        SqlCommand cmd = new SqlCommand(query, cnx);
                        SqlDataReader dr = cmd.ExecuteReader();
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {

                                string descripcion_curso = dr["descripcion_curso"].ToString();
                                string FechaInicio = dr["fecha_inicio_cap"].ToString();
                                string FechaFin = dr["fecha_fin_cap"].ToString();
                                cc += 1;
                                if (cc == 1)
                                {
                                    lbCursosAnt.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 2)
                                {
                                    lbCurso1.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 3)
                                {
                                    lbCurso2.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 4)
                                {
                                    lbCurso3.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 5)
                                {
                                    lbCurso4.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 6)
                                {
                                    lbCurso5.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 7)
                                {
                                    lbCurso6.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 8)
                                {
                                    lbCurso7.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 9)
                                {
                                    lbCurso8.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 10)
                                {
                                    lbCurso9.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                                if (cc == 11)
                                {
                                    lbCurso10.Text = descripcion_curso + " Fecha Inicio: " + FechaInicio + " Fecha Fin: " + FechaFin;
                                }
                            }
                        }
                    }


                    //------------------------------------------------------------------------para sacar la evaluacion
                    //para buscar la ultima calificacion de evaluacion
                    List<EntidadCalificacionEva> listaEva = negocioEva.ListaPlantilla();
                    if (listaEva == null)
                    {
                        //MensajeErrorFiltros(negocioEva.Log + "/ O no se encuentra la plantilla Actualizada");
                        //panel1.Visible = false;
                        return;
                    }
                    else
                    {
                        lbPlantilla.Text = listaEva[0].PlantillaEva.ToString();
                    }

                    //para sacar puntaje de Indicadores
                    EntidadCalificacionEva entidadEvaluacion = new EntidadCalificacionEva();

                    entidadEvaluacion.PlantillaEva = lbPlantilla.Text;
                    entidadEvaluacion.NoEmpleado = noempleado;

                    NegocioPlantillaEva negocioEvalaucion = new NegocioPlantillaEva();
                    DataTable DgPuntajeIndicadores = negocioEvalaucion.BuscarPuntajeInd(entidadEvaluacion, entidadEvaluacion);
                    if (DgPuntajeIndicadores != null)
                    {
                        if (DgPuntajeIndicadores.Rows.Count != 0)
                        {
                            foreach (DataRow fila in DgPuntajeIndicadores.Rows)
                            {
                                noemp.Text = fila["no_emp"].ToString();
                                evaid.Text = fila["evaluacion"].ToString();
                                calindicador.Text = fila["totalpuntaje"].ToString();
                            }
                        }
                    }
                    //para sacar el puntaje en seccion valores de la evaluacion de desempeño
                    EntidadCalificacionEva entidadPuntajeVal = new EntidadCalificacionEva();
                    entidadPuntajeVal.Evaluacion = evaid.Text;
                    entidadPuntajeVal.PlantillaEva = lbPlantilla.Text;
                    DataTable DgPuntajeValores = negocioEvalaucion.BuscarPuntajeVal(entidadPuntajeVal, entidadPuntajeVal);
                    if (DgPuntajeValores != null)
                    {
                        if (DgPuntajeValores.Rows.Count != 0)
                        {
                            foreach (DataRow filaval in DgPuntajeValores.Rows)
                            {
                                lbCalval.Text = filaval["total_puntaje_val"].ToString();
                            }
                        }
                    }

                    //para obtener el valor general de la evaluacion con calificacion de Indicadores 
                    EntidadCalificacionEva entidadPuntajeGral = new EntidadCalificacionEva();
                    entidadPuntajeGral.CalificacionInd = calindicador.Text;
                    DataTable DgPuntajeIndicadoresLetra = negocioEvalaucion.BuscarPuntajeGeneral(entidadPuntajeGral);
                    if (DgPuntajeIndicadoresLetra != null)
                    {
                        if (DgPuntajeIndicadoresLetra.Rows.Count != 0)
                        {
                            foreach (DataRow filaval in DgPuntajeIndicadoresLetra.Rows)
                            {
                                lbCalificacionkpi.Text = filaval["calificacion_kpi"].ToString();
                                desc_calind.Text = filaval["descripcion_kpi"].ToString().ToUpper();
                            }
                        }
                    }

                    //para obtener la descripcion de los valores del puntaje obtenido 
                    EntidadCalificacionEva entidadCalValores = new EntidadCalificacionEva();
                    entidadCalValores.CalificacionVal = lbCalval.Text;
                    DataTable DgPuntajeValoresLetra = negocioEvalaucion.BuscarDescCalValores(entidadCalValores);
                    if (DgPuntajeValoresLetra != null)
                    {
                        if (DgPuntajeValoresLetra.Rows.Count != 0)
                        {
                            foreach (DataRow filaval in DgPuntajeValoresLetra.Rows)
                            {
                                lbDescval.Text = filaval["descripcion_pondera"].ToString();
                            }
                        }
                    }

                    if (lbCalval.Text != "" && lbCalificacionkpi.Text != "")
                    {
                        //para sacar el resultado general de la evaluacion

                        //================================PARA SACAR RESULTADO DE LA CALIFICION GRAL============
                        if ((Convert.ToInt32(lbCalval.Text.Trim()) >= 17) && ((Convert.ToInt32(lbCalval.Text.Trim())) <= 22))
                        {
                            if (lbCalificacionkpi.Text == "A" || lbCalificacionkpi.Text == "B")
                            {
                                calificacion_total.Text = "CRITICO";
                            }
                            if (lbCalificacionkpi.Text == "C-" || lbCalificacionkpi.Text == "C")
                            {
                                calificacion_total.Text = "NECESITA CAPACITAR/ENTRENAR";
                            }
                            if (lbCalificacionkpi.Text == "C+" || lbCalificacionkpi.Text == "D")
                            {
                                calificacion_total.Text = "NECESITA CAPACITAR/ENTRENAR";
                            }
                        }
                        else
                        {
                            if ((Convert.ToInt32(lbCalval.Text.Trim()) >= 23) && (Convert.ToInt32(lbCalval.Text.Trim()) <= 45))
                            {
                                if (lbCalificacionkpi.Text.Trim() == "A" || lbCalificacionkpi.Text.Trim() == "B")
                                {
                                    calificacion_total.Text = "NECESITA CAPACITAR/ENTRENAR";
                                }
                                if (lbCalificacionkpi.Text.Trim() == "C-" || lbCalificacionkpi.Text.Trim() == "C")
                                {
                                    calificacion_total.Text = "RECONOCER Y DESARROLLAR";
                                }
                                if (lbCalificacionkpi.Text.Trim() == "C+" || lbCalificacionkpi.Text.Trim() == "D")
                                {
                                    calificacion_total.Text = "RECONOCER Y DESARROLLAR";
                                }
                            }
                            else
                            {
                                if ((Convert.ToInt32(lbCalval.Text) >= 45) && (Convert.ToInt32(lbCalval.Text.Trim()) <= 51))
                                {
                                    if (lbCalificacionkpi.Text.Trim() == "A" || lbCalificacionkpi.Text.Trim() == "B")
                                    {
                                        calificacion_total.Text = "NECESITA CAPACITAR/ENTRENAR";
                                    }
                                    if (lbCalificacionkpi.Text.Trim() == "C-" || lbCalificacionkpi.Text.Trim() == "C")
                                    {
                                        calificacion_total.Text = "RECONOCER Y DESARROLLAR";
                                    }
                                    if (lbCalificacionkpi.Text.Trim() == "C+" || lbCalificacionkpi.Text.Trim() == "D")
                                    {
                                        calificacion_total.Text = "RETENER";
                                    }
                                }
                            }
                        }
                    }
                    //----------------------------------------------------------------------------------------------------
                    //ExportarPDF();
                }
            }
            else
            {
                Lbpermiso.Text = "NO TIENES PERMISO PARA ESTE MODULO";
            }
        }