private void CargarDatos()
        {
            DocumentoAutorizarNegocio nDocumento = new DocumentoAutorizarNegocio();
            ProgramaNegocio           nPrograma  = new ProgramaNegocio();

            XElement Documento = nDocumento.ObtieneTablasDocumentoAutorizacion(vIdPrograma, vIdPeriodo);

            if (Documento != null)
            {
                DeserializarDocumentoAutorizar(Documento);
                ptipo = "Editar";

                if (vDocumento != null)
                {
                    if (vPrograma != null)
                    {
                        vIdDocumento = vPrograma.ID_DOCUMENTO_AUTORIZACION;
                        if (vPrograma.CL_ESTADO.Equals("Terminado"))
                        {
                            btnEnviar.Enabled      = false;
                            btnEliminar.Enabled    = false;
                            btnSeleccionar.Enabled = false;
                            btnAceptar.Enabled     = false;
                        }
                    }

                    if (vPeriodo != null)
                    {
                        vIdDocumento = vPeriodo.ID_DOCUMENTO_AUTORIZACION;
                    }

                    txtClDocumento.Text           = vDocumento.CL_DOCUMENTO.ToString();
                    txtElaboro.Text               = vDocumento.NB_EMPLEADO_ELABORA.ToString();
                    txtVersionDocumento.Text      = vDocumento.VERSION.ToString();
                    rdpFechaRevision.SelectedDate = vDocumento.FE_REVISION;
                    rdpFeElaboracion.Enabled      = false;
                    rdpFeElaboracion.SelectedDate = vDocumento.FE_ELABORACION;
                }
                else
                {
                    ptipo           = "Agregar";
                    txtElaboro.Text = ContextoUsuario.oUsuario.NB_USUARIO.ToString();
                }
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            DocumentoAutorizarNegocio nDocumentoAutorizar = new DocumentoAutorizarNegocio();

            string   autoriza       = (chkActivo.Checked) ? "Autorizado" : "No autorizado";
            XElement vXelementNotas = null;

            var vXelementNota =
                new XElement("NOTA",
                             new XAttribute("FE_NOTA", DateTime.Now.ToString()),
                             new XAttribute("DS_NOTA", radObservaciones.Content.ToString())
                             );

            vXelementNotas = new XElement("NOTAS", vXelementNota);

            E_RESULTADO vResultado = nDocumentoAutorizar.ActualizaEstatusDocumentoAutorizacion(vFlAutorizacion, autoriza, vXelementNotas.ToString(), null, vClUsuario, vNbPrograma);
            string      vMensaje   = vResultado.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE;

            UtilMensajes.MensajeResultadoDB(rwmMensaje, vMensaje, vResultado.CL_TIPO_ERROR, 400, 150, "");
            string myUrl = ResolveUrl("~/Logon.aspx");

            Response.Redirect(ContextoUsuario.nbHost + myUrl);
        }
Beispiel #3
0
        protected void btnSiguiente_Click(object sender, EventArgs e)
        {
            if (ptipo.Equals("PROGRAMACAPACITACION"))
            {
                if (!pClaveToken.Equals(""))
                {
                    if (vIdPrograma != null)
                    {
                        if (txtClave.Text.ToString().Equals(pClaveToken))
                        {
                            ProgramaNegocio nPrograma             = new ProgramaNegocio();
                            var             vprogramaCapacitacion = nPrograma.ObtieneProgramasCapacitacion(pIdPrograma: vIdPrograma).FirstOrDefault();
                            if (vprogramaCapacitacion != null)
                            {
                                DocumentoAutorizarNegocio nDocumento = new DocumentoAutorizarNegocio();

                                SPE_OBTIENE_C_AUTORIZACION_DCTO_EMPLEADO_Result vDocumento = new SPE_OBTIENE_C_AUTORIZACION_DCTO_EMPLEADO_Result();

                                vDocumento = nDocumento.ObtieneEmpleadoDocumentoAutorizacion(pFlAutorizacion: pFolioAutorizacion).FirstOrDefault();

                                if (vDocumento != null)
                                {
                                    if (vDocumento.CL_ESTADO.ToUpper().Equals("POR AUTORIZAR"))
                                    {
                                        Response.Redirect("~/FYD/EvaluacionCompetencia/AutorizaProgramaCapacitacion.aspx?ID=" + vIdPrograma + "&TOKEN=" + pFolioAutorizacion);
                                    }
                                    else
                                    {
                                        UtilMensajes.MensajeResultadoDB(RadWindowManager1, "El documento ya fue autorizado o rechazado y no se puede modificar.", E_TIPO_RESPUESTA_DB.ERROR);
                                    }
                                }
                                else
                                {
                                    UtilMensajes.MensajeResultadoDB(RadWindowManager1, "El documento no existe.", E_TIPO_RESPUESTA_DB.ERROR);
                                }
                            }
                        }
                        else
                        {
                            UtilMensajes.MensajeResultadoDB(RadWindowManager1, "Las contraseñas no coinciden.", E_TIPO_RESPUESTA_DB.ERROR);
                        }
                    }

                    if (vIdPeriodo != null)
                    {
                        if (txtClave.Text.ToString().Equals(pClaveToken))
                        {
                            SIGE.Negocio.FormacionDesarrollo.PeriodoNegocio nPrograma = new SIGE.Negocio.FormacionDesarrollo.PeriodoNegocio();
                            DocumentoAutorizarNegocio nDocumento = new DocumentoAutorizarNegocio();
                            var DocumentoAutorizar = nDocumento.ObtieneEmpleadoDocumentoAutorizacion(pFlAutorizacion: pFolioAutorizacion).FirstOrDefault();
                            var vPeriodo           = nPrograma.ObtienePeriodoEvaluacion(vIdPeriodo.Value);
                            if (vPeriodo != null)
                            {
                                if (DocumentoAutorizar.CL_ESTADO == "Autorizado")
                                {
                                    UtilMensajes.MensajeResultadoDB(RadWindowManager1, "Ya se ha capturado una respuesta a esta autorización.", E_TIPO_RESPUESTA_DB.ERROR);
                                }
                                else
                                {
                                    Response.Redirect("~/FYD/EvaluacionCompetencia/AutorizarPeriodoEvaluacion.aspx?IdPeriodo=" + vIdPeriodo + "&TOKEN=" + pFolioAutorizacion);
                                }
                            }
                        }
                        else
                        {
                            UtilMensajes.MensajeResultadoDB(RadWindowManager1, "Las contraseñas no coinciden.", E_TIPO_RESPUESTA_DB.ERROR);
                        }
                    }
                }
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["ClProceso"] != null)
                {
                    pe = new ProcesoExterno();
                    //En esta parte tiene que procesar los datos para el proceso externo. Vamos a obtener el proceso, el Guid, en base al proceso es el div que se mostrara.
                    //Se hara una funcion para mostrar los divs

                    vClProceso    = Request.QueryString["ClProceso"];
                    vFolioProceso = Guid.Parse(Request.QueryString["FlProceso"]);
                }


                if ((Request.QueryString["AUTORIZA"]) != null)
                {
                    ptipo = (string)(Request.QueryString["AUTORIZA"]);
                    pFolioAutorizacion = Guid.Parse((Request.QueryString["TOKEN"]));
                    DocumentoAutorizarNegocio nDocumento = new DocumentoAutorizarNegocio();
                    var DocumentoAutorizar = nDocumento.ObtieneEmpleadoDocumentoAutorizacion(pFlAutorizacion: pFolioAutorizacion).Where(w => w.ID_PERIODO != null).FirstOrDefault();

                    if (DocumentoAutorizar != null)
                    {
                        if (DocumentoAutorizar.ID_PROGRAMA != null)
                        {
                            txtProgramaCapacitacion.Text = DocumentoAutorizar.NB_PROGRAMA.ToString();
                            vIdPrograma = DocumentoAutorizar.ID_PROGRAMA;
                            txtProgramaCapacitacion.ReadOnly = true;
                            txtAutorizador.ReadOnly          = true;
                        }
                        else
                        {
                            txtProgramaCapacitacion.Text = DocumentoAutorizar.NB_PERIODO;
                            vIdPeriodo = DocumentoAutorizar.ID_PERIODO;
                            txtProgramaCapacitacion.ReadOnly = true;
                            txtAutorizador.ReadOnly          = true;
                        }

                        //txtAutorizador.Text = DocumentoAutorizar.NB_EMPLEADO_ELABORA.ToString();
                        txtAutorizador.Text = DocumentoAutorizar.NB_EMPLEADO.ToString();
                        pClaveToken         = DocumentoAutorizar.CL_TOKEN.ToString();
                    }
                    ContentAutorizaDocumentos.Visible = true;
                    ContentLogin.Visible                     = false;
                    ContentPasswordRecovery.Visible          = false;
                    ContentCodigoConfirmacion.Visible        = false;
                    ContentEvaluacionResultados.Visible      = false;
                    ContentCuestionarios.Visible             = false;
                    ContentClimaLaboral.Visible              = false;
                    ContentCartera.Visible                   = false;
                    ContentEntrevista.Visible                = false;
                    ContentRequisiciones.Visible             = false;
                    ContentAutorizaRequisicion.Visible       = false;
                    ContentEvaluacionDesempeno.Visible       = false;
                    ContentAutorizaPuestoRequisicion.Visible = false;
                    ContentCuestionario.Visible              = false;
                }
                else
                {
                    ContentPasswordRecovery.Visible     = false;
                    ContentCodigoConfirmacion.Visible   = false;
                    ContentAutorizaDocumentos.Visible   = false;
                    ContentEvaluacionResultados.Visible = false;
                    ContentCuestionarios.Visible        = false;
                    ContentClimaLaboral.Visible         = false;
                    ContentCartera.Visible                   = false;
                    ContentEntrevista.Visible                = false;
                    ContentRequisiciones.Visible             = false;
                    ContentAutorizaRequisicion.Visible       = false;
                    ContentEvaluacionDesempeno.Visible       = false;
                    ContentAutorizaPuestoRequisicion.Visible = false;
                    ContentCuestionario.Visible              = false;
                }

                mostrarDiv();
                FgLicenciaActiva();
            }

            PlantillaFormularioNegocio nPlantilla = new PlantillaFormularioNegocio();
            List <SPE_OBTIENE_C_PLANTILLAS_EXTERNAS_Result> vLstPlantillas = nPlantilla.ObtenerPlantillasExternas("EXTERIOR");

            foreach (var item in vLstPlantillas)
            {
                HtmlGenericControl viSolicitud = new HtmlGenericControl("i");
                viSolicitud.Attributes.Add("class", "fa fa-file-text");
                HtmlGenericControl vControlSolicitud = new HtmlGenericControl("a");
                vControlSolicitud.Attributes.Add("href", "#");
                vControlSolicitud.Attributes.Add("onclick", "return OpenWindowPlantilla(" + item.ID_PLANTILLA_SOLICITUD.ToString() + ");");
                vControlSolicitud.Attributes.Add("style", "margin: 20px;");
                vControlSolicitud.InnerText = item.NB_PLANTILLA_SOLICITUD;
                vControlSolicitud.Style.Add("font-size", "14px");
                vControlSolicitud.Style.Add(" font-family", "sans-serif");
                viSolicitud.Controls.Add(vControlSolicitud);
                dvSolicitudes.Controls.Add(viSolicitud);
            }
            if (vLstPlantillas.Count > 1)
            {
                int vTamanoDiv = vLstPlantillas.Count * 35;
                dvSolicitudes.Style.Add("height", vTamanoDiv.ToString() + "px");
            }

            lblEmpresa.InnerText           = ContextoApp.InfoEmpresa.NbEmpresa;
            rbiLogoOrganizacion1.DataValue = ContextoApp.InfoEmpresa.FiLogotipo.FiArchivo;
            rbiLogoOrganizacion2.DataValue = ContextoApp.InfoEmpresa.FiLogotipo.FiArchivo;
            rbiLogoOrganizacion3.DataValue = ContextoApp.InfoEmpresa.FiLogotipo.FiArchivo;

            //Licencia
            if (ContextoApp.InfoEmpresa.MsgSistema != "1")
            {
                btnLogin.Enabled                          = false;
                btnRecuperarPassword.Enabled              = false;
                btnAbrirCuestionario.Enabled              = false;
                btnAbrirCuestionarioClima.Enabled         = false;
                btnAbrirCuestionarioDesempeno.Enabled     = false;
                btnAbrirCuestionarioIndependiente.Enabled = false;
                btnAbrirEntrevista.Enabled                = false;
                btnAbrirEvaluacion.Enabled                = false;
                btnAbrirRequisicion.Enabled               = false;
                btnAutorizarReqPuesto.Enabled             = false;
                btnCartera.Enabled                        = false;
                btnConfirmarCodigo.Enabled                = false;
                btnEnviarPorCuenta.Enabled                = false;
                btnIntroducirCodigo.Enabled               = false;
                btnSiguiente.Enabled                      = false;
                UtilMensajes.MensajeResultadoDB(RadWindowManager1, ContextoApp.InfoEmpresa.MsgSistema, E_TIPO_RESPUESTA_DB.WARNING);
            }
            // Fin de licencia
        }
        protected void btnEnviar_Click(object sender, EventArgs e)
        {
            E_RESULTADO vResultado = GuardarEmpleadosAutorizar();

            if (vResultado.CL_TIPO_ERROR.ToString().Equals(E_TIPO_RESPUESTA_DB.SUCCESSFUL.ToString()))
            {
                string vClEstadoMail = "SendMail";
                //int contador = 0;
                string vTitulo;
                string vTipo;

                if (vPrograma != null)
                {
                    vTitulo = "Autorización programa de capacitación    ";
                    vTipo   = "Programa Capacitacion";
                }
                else
                {
                    vTitulo = "Autorización matriz de evaluación";
                    vTipo   = "Matriz evaluacion";
                }


                foreach (GridItem item in grdDocumentosAutorizar.SelectedItems)
                {
                    GridDataItem vDataItem = item as GridDataItem;

                    int idAutorizacion = int.Parse(vDataItem.GetDataKeyValue("ID_AUTORIZACION").ToString());
                    //RadTextBox vClCorreoElectronico = (RadTextBox)vDataItem.FindControl("txtClCorreoElectronico");

                    string nbEmpleado = vDataItem.GetDataKeyValue("NB_EMPLEADO").ToString();
                    //Persona aquien se enviara la autorizacion

                    var vDocumento = vDocumentosAutorizar.Where(x => x.ID_AUTORIZACION == idAutorizacion).FirstOrDefault();
                    //vDocumento.CL_CORREO_ELECTRONICO = vClCorreoElectronico.Text;

                    Mail mail = new Mail(ContextoApp.mailConfiguration);

                    String vCorreoElectronico = (vDataItem.FindControl("txtClCorreoElectronico") as RadTextBox).Text;
                    //String vNbEmpleado = documentoMail.NB_EMPLEADO;
                    //Guid vFlAutorizacion = documentoMail.FL_AUTORIZACION;

                    //string vClToken = documentoMail.CL_TOKEN.ToString();
                    mail.addToAddress(vCorreoElectronico, vDocumento.NB_EMPLEADO);
                    //contador++;
                    string myUrl           = ResolveUrl("~/Logon.aspx?AUTORIZA=PROGRAMACAPACITACION&TOKEN=");
                    string vUrl            = ContextoUsuario.nbHost + myUrl + vDocumento.FL_AUTORIZACION.ToString();
                    string vResultadoEnvio = "";

                    try
                    {
                        switch (vClEstadoMail)
                        {
                        case "SendMail":
                            if (vTipo == "Matriz evaluacion")
                            {
                                vResultadoEnvio = mail.Send(vTitulo, String.Format(" <html>" +
                                                                                   " <head>" +
                                                                                   " <title>Solicitud</title>" +
                                                                                   " <meta charset=\"utf-8\"> " +
                                                                                   " </head>" +
                                                                                   " <body>" +
                                                                                   " <p>Estimado(a):  <b> " + nbEmpleado + " </b></p>" +
                                                                                   " <p> Por medio de la presente te informamos que has recibido una solicitud para autorizar la matriz de evaluación de competencias del período: <b>" + vPeriodo.NB_PERIODO + " </b></p> " +
                                                                                   " <p> Para autorizar, da clik <a href=\"{1}\" >aquí</a> </p>" +
                                                                                   " <p>Tu contraseña de acceso es <b>{0}</b></p>" +
                                                                                   " <p>¡Gracias por tu apoyo! </p>" +
                                                                                   " </body>" +
                                                                                   " </html>",
                                                                                   vDocumento.CL_TOKEN.ToString(),
                                                                                   vUrl
                                                                                   ));
                            }
                            else if (vTipo == "Programa Capacitacion")
                            {
                                vResultadoEnvio = mail.Send(vTitulo, String.Format(" <html>" +
                                                                                   " <head>" +
                                                                                   " <title>Solicitud</title>" +
                                                                                   " <meta charset=\"utf-8\"> " +
                                                                                   " </head>" +
                                                                                   " <body>" +
                                                                                   " <p>Estimado(a):  <b> " + nbEmpleado + " </b></p>" +
                                                                                   " <p> Por medio de la presente te informamos que has recibido una solicitud para autorizar el programa de capacitación <b>" + vPrograma.NB_PROGRAMA + " </b></p> " +
                                                                                   " <p> Para autorizar, da clik <a href=\"{1}\" >aquí</a> </p>" +
                                                                                   " <p> La contraseña de acceso es <b>{0}</b></p>" +
                                                                                   " <p>¡Gracias por tu apoyo! </p>" +
                                                                                   " </body>" +
                                                                                   " </html>",
                                                                                   vDocumento.CL_TOKEN.ToString(),
                                                                                   vUrl
                                                                                   ));
                            }

                            break;
                        }
                        if (vResultadoEnvio == "0")
                        {
                            DocumentoAutorizarNegocio nDocumento = new DocumentoAutorizarNegocio();
                            E_RESULTADO vResultadoActualiza      = nDocumento.ActualizaEstadoAutorizaDoc(idAutorizacion, vClUsuario, vNbPrograma);
                            if (vResultadoActualiza.CL_TIPO_ERROR.ToString().Equals(E_TIPO_RESPUESTA_DB.SUCCESSFUL.ToString()))
                            {
                                UtilMensajes.MensajeResultadoDB(rwmMensaje, "Se mandó el correo exitosamente", E_TIPO_RESPUESTA_DB.SUCCESSFUL, pCallBackFunction: "");
                            }
                            else
                            {
                                UtilMensajes.MensajeResultadoDB(rwmMensaje, vResultadoActualiza.ToString(), E_TIPO_RESPUESTA_DB.ERROR);
                            }
                        }
                        else
                        {
                            UtilMensajes.MensajeResultadoDB(rwmMensaje, vResultadoEnvio, E_TIPO_RESPUESTA_DB.WARNING, pCallBackFunction: "");
                        }
                    }
                    catch (Exception)
                    {
                        UtilMensajes.MensajeResultadoDB(rwmMensaje, "Error al procesar el Email", E_TIPO_RESPUESTA_DB.ERROR);
                    }
                }
            }
            else
            {
                UtilMensajes.MensajeResultadoDB(rwmMensaje, "Error al procesar el Email", E_TIPO_RESPUESTA_DB.ERROR);
            }
        }
        public E_RESULTADO GuardarEmpleadosAutorizar()
        {
            DocumentoAutorizarNegocio nDocumentoAutorizar = new DocumentoAutorizarNegocio();

            if (ptipo.Equals("Agregar") && vDocumento == null)
            {
                vDocumento = new E_DOCUMENTO_AUTORIZAR
                {
                    ID_DOCUMENTO_AUTORIZACION = 0,
                    CL_DOCUMENTO        = txtClDocumento.Text,
                    NB_DOCUMENTO        = "",
                    CL_TIPO_DOCUMENTO   = "",
                    DS_NOTAS            = "",
                    VERSION             = txtVersionDocumento.Text,
                    FE_ELABORACION      = rdpFeElaboracion.SelectedDate,
                    FE_REVISION         = rdpFechaRevision.SelectedDate,
                    NB_EMPLEADO_ELABORA = txtElaboro.Text
                };
            }

            int contador = 0;

            foreach (GridDataItem item in grdDocumentosAutorizar.MasterTableView.Items)
            {
                RadTextBox vClCorreoElectronico = (RadTextBox)item.FindControl("txtClCorreoElectronico");
                vDocumentosAutorizar.ElementAt(contador).CL_CORREO_ELECTRONICO = vClCorreoElectronico.Text;
                contador++;
            }

            var vXelementDocumento =
                new XElement("DOCUMENTO",
                             new XAttribute("ID_DOCUMENTO_AUTORIZACION", vDocumento.ID_DOCUMENTO_AUTORIZACION.ToString()),
                             new XAttribute("CL_DOCUMENTO", (ptipo.Equals("Agregar")) ? vDocumento.CL_DOCUMENTO.ToString() : txtClDocumento.Text.ToString()),
                             new XAttribute("NB_DOCUMENTO", vDocumento.NB_DOCUMENTO.ToString()),
                             new XAttribute("CL_TIPO_DOCUMENTO", vDocumento.CL_TIPO_DOCUMENTO.ToString()),
                             new XAttribute("DS_NOTAS", vDocumento.DS_NOTAS.ToString()),
                             new XAttribute("VERSION", (ptipo.Equals("Agregar")) ? vDocumento.VERSION.ToString() : txtVersionDocumento.Text),
                             new XAttribute("FE_ELABORACION", (ptipo.Equals("Agregar")) ? vDocumento.FE_ELABORACION.ToString() : rdpFeElaboracion.SelectedDate.ToString()),
                             new XAttribute("FE_REVISION", (ptipo.Equals("Agregar")) ? vDocumento.FE_REVISION.ToString() : (rdpFechaRevision.SelectedDate != null) ? rdpFechaRevision.SelectedDate.ToString() : ""),
                             new XAttribute("NB_EMPLEADO_ELABORA", (ptipo.Equals("Agregar")) ? vDocumento.NB_EMPLEADO_ELABORA.ToString() : txtElaboro.Text.ToString()));

            var vXelementEmpleadosAutorizar = vDocumentosAutorizar.Select(x =>
                                                                          new XElement("EMPLEADO_AUTORIZAR",
                                                                                       new XAttribute("ID_AUTORIZACION", x.ID_AUTORIZACION.ToString()),
                                                                                       new XAttribute("FL_AUTORIZACION", x.FL_AUTORIZACION.ToString()),
                                                                                       new XAttribute("CL_TOKEN", x.CL_TOKEN.ToString()),
                                                                                       new XAttribute("ID_EMPLEADO", x.ID_EMPLEADO.ToString()),
                                                                                       new XAttribute("NB_EMPLEADO", x.NB_EMPLEADO.ToString()),
                                                                                       new XAttribute("ID_DOCUMENTO", x.ID_DOCUMENTO.ToString()),
                                                                                       new XAttribute("CL_ESTADO", x.CL_ESTADO.ToString()),
                                                                                       new XAttribute("DS_OBSERVACIONES", ConvertirNota(x.DS_OBSERVACIONES.ToString())),
                                                                                       new XAttribute("FE_AUTORIZACION", x.FE_AUTORIZACION.ToString())));

            XElement programaCapacitacion =
                new XElement("CONFIGURACION",
                             new XElement("DOCUMENTOS", vXelementDocumento),
                             new XElement("EMPLEADOS_AUTORIZAR", vXelementEmpleadosAutorizar));

            E_RESULTADO vResultado = nDocumentoAutorizar.InsertaActualizaDocumentoAutorizacion(vIdDocumento, vIdPeriodo, vIdPrograma, programaCapacitacion.ToString(), vClUsuario, vNbPrograma);

            return(vResultado);
        }