Пример #1
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);
                        }
                    }
                }
            }
        }
Пример #2
0
        protected void grdPrograma_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            ProgramaNegocio neg = new ProgramaNegocio();

            grdPrograma.DataSource = neg.ObtieneProgramasCapacitacion(pXML_PROGRAMAS_SELECCION: vXmlTipoSeleccion);
        }
        public void GuardarProgramaCapacitacion()
        {
            var      vClEstatusPrograma = (!ptipo.Equals("Editar")) ? new string(CharsToTitleCase(txtEstadoProgCapacitacion.Text).ToArray()) : new string(CharsToTitleCase(pProgramaCapacitacion.CL_ESTADO.ToString()).ToArray());
            XElement vXelementNotas     = null;

            string plIdPeriodo  = "";
            string plIdPrograma = "";
            string plVersion    = "";
            string plIdDocumentoAutorizacion = "0";

            var vXelementNota = new XElement("NOTA",
                                             new XAttribute("FE_NOTA", (!ptipo.Equals("Editar")) ? DateTime.Now.ToString() : (pNota != null) ? DateTime.Now.ToString() : DateTime.Now.ToString()),
                                             new XAttribute("DS_NOTA", (!ptipo.Equals("Editar")) ? radEditorNotas.Content : radEditorNotas.Content));

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

            if (pProgramaCapacitacion != null)
            {
                if (pProgramaCapacitacion.ID_PERIODO.HasValue)
                {
                    plIdPeriodo = pProgramaCapacitacion.ID_PERIODO.ToString();
                }

                plIdPrograma = pProgramaCapacitacion.ID_PROGRAMA.ToString();
                plVersion    = pProgramaCapacitacion.VERSION;
                plIdDocumentoAutorizacion = pProgramaCapacitacion.ID_DOCUMENTO_AUTORIZACION.ToString();
            }

            var vXelementProgramaCapacitacion =
                new XElement("PROGRAMA",
                             new XAttribute("ID_PROGRAMA", (!ptipo.Equals("Editar")) ? "0" : plIdPrograma),
                             new XAttribute("ID_PERIODO", ((!ptipo.Equals("Editar")) && (!ptipo.Equals("Copy"))) ? "0" : plIdPeriodo),
                             //new XAttribute("CL_PROGRAMA", (!ptipo.Equals("Editar")) ? txtClProgCapacitacion.Text : pProgramaCapacitacion.CL_PROGRAMA.ToString()),
                             new XAttribute("CL_PROGRAMA", txtClProgCapacitacion.Text),
                             //new XAttribute("NB_PROGRAMA", (!ptipo.Equals("Editar")) ? txtNbProgCapacitacion.Text : pProgramaCapacitacion.NB_PROGRAMA.ToString()),
                             new XAttribute("NB_PROGRAMA", txtNbProgCapacitacion.Text),
                             //new XAttribute("CL_TIPO_PROGRAMA", (!ptipo.Equals("Editar")) ? txtTipoProgCapacitacion.Text : pProgramaCapacitacion.CL_TIPO_PROGRAMA.ToString()),
                             // new XAttribute("CL_TIPO_PROGRAMA", txtTipoProgCapacitacion.Text),
                             new XAttribute("CL_TIPO_PROGRAMA", rbDnc.Checked ? "Desde DNC" : rbCopia.Checked ? "Copia" : "A partir de 0"),
                             //new XAttribute("CL_VERSION", (!ptipo.Equals("Editar")) ? "" : pProgramaCapacitacion.VERSION.ToString()),
                             new XAttribute("CL_VERSION", plVersion),
                             new XAttribute("CL_ESTADO", vClEstatusPrograma),
                             new XAttribute("DS_NOTAS", (vXelementNotas != null) ? vXelementNotas.ToString() : ""),
                             //new XAttribute("ID_DOCUMENTO_AUTORIZACION", (!ptipo.Equals("Editar")) ? 0 : pProgramaCapacitacion.ID_DOCUMENTO_AUTORIZACION
                             new XAttribute("ID_DOCUMENTO_AUTORIZACION", plIdDocumentoAutorizacion)
                             );


            var vXelementCompetencias = vCompetencias.Select(x =>
                                                             new XElement("COMPETENCIA",
                                                                          new XAttribute("ID_PROGRAMA_COMPETENCIA", (!ptipo.Equals("Editar")) ? "0" : x.ID_PROGRAMA_COMPETENCIA.ToString()),
                                                                          new XAttribute("ID_COMPETENCIA", x.ID_COMPETENCIA),
                                                                          new XAttribute("NB_COMPETENCIA", x.NB_COMPETENCIA),
                                                                          new XAttribute("NB_CLASIFICACION", x.NB_CLASIFICACION),
                                                                          new XAttribute("NB_CATEGORIA", x.NB_CATEGORIA)
                                                                          ));

            var vXelementEmpleados = vEmpleados.Select(x =>
                                                       new XElement("EMPLEADO",
                                                                    new XAttribute("ID_PROGRAMA_EMPLEADO", (!ptipo.Equals("Editar")) ? "0" : x.ID_PROGRAMA_EMPLEADO.ToString()),
                                                                    new XAttribute("ID_EMPLEADO", x.ID_EMPLEADO),
                                                                    new XAttribute("ID_AUXILIAR", x.ID_AUXILIAR),
                                                                    new XAttribute("NB_EMPLEADO", x.NB_EMPLEADO),
                                                                    new XAttribute("CL_EMPLEADO", x.CL_EMPLEADO),
                                                                    new XAttribute("NB_PUESTO", x.NB_PUESTO),
                                                                    new XAttribute("CL_PUESTO", x.CL_PUESTO),
                                                                    new XAttribute("NB_DEPARTAMENTO", x.NB_DEPARTAMENTO)
                                                                    ));

            var vXelementProgramasCapacitacion =
                vProgramas.Select(x => new XElement("PROGRAMA_CAPACITACION",
                                                    new XAttribute("ID_PROGRAMA_EMPLEADO_COMPETENCIA", (!ptipo.Equals("Editar")) ? "0" : x.ID_PROGRAMA_EMPLEADO_COMPETENCIA.ToString()),
                                                    new XAttribute("CL_PRIORIDAD", x.CL_PRIORIDAD),
                                                    new XAttribute("PR_RESULTADO", x.PR_RESULTADO),
                                                    new XAttribute("ID_PROGRAMA_EMPLEADO", x.ID_PROGRAMA_EMPLEADO),
                                                    new XAttribute("ID_PROGRAMA_COMPETENCIA", x.ID_PROGRAMA_COMPETENCIA),
                                                    new XAttribute("ID_EMPLEADO", x.ID_EMPLEADO),
                                                    new XAttribute("ID_COMPETENCIA", x.ID_COMPETENCIA)
                                                    ));



            XElement programaCapacitacion =
                new XElement("CONFIGURACION",
                             new XElement("PROGRAMAS", vXelementProgramaCapacitacion),
                             new XElement("COMPETENCIAS", vXelementCompetencias),
                             new XElement("EMPLEADOS", vXelementEmpleados),
                             new XElement("PROGRAMAS_CAPACITACION", vXelementProgramasCapacitacion)
                             );


            ProgramaNegocio nPrograma = new ProgramaNegocio();

            if (ptipo.Equals("Editar"))
            {
                vIdPrograma = vIdPrograma;
            }
            else
            {
                vIdPrograma = null;
            }

            if (rbDnc.Checked && ptipo != "Editar")
            {
                if (lstPeriodo.SelectedValue != "")
                {
                    NecesidadesCapacitacionNegocio neg = new NecesidadesCapacitacionNegocio();
                    string vXmlProgramaDnc             = GenerarXmlProgramaPrograma(int.Parse(lstPeriodo.SelectedValue.ToString()));

                    E_RESULTADO res      = neg.InsertaActualizaProgramaDesdeDNC(vIdPrograma, vXmlProgramaDnc.ToString(), vClUsuario, vNbPrograma);
                    string      vMensaje = res.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE;
                    UtilMensajes.MensajeResultadoDB(rwmMensaje, vMensaje, res.CL_TIPO_ERROR, pCallBackFunction: "ReturnDataToParent");
                }
                else
                {
                    UtilMensajes.MensajeResultadoDB(rwmMensaje, "Selecciona el período para generar desde DNC.", E_TIPO_RESPUESTA_DB.ERROR, pCallBackFunction: "");
                    desdeDNC.Style.Add("display", "block");
                    return;
                }
            }
            else
            {
                E_RESULTADO vResultado = nPrograma.InsertaActualizaProgramaCapacitacion(vIdPrograma, programaCapacitacion.ToString(), vClUsuario, vNbPrograma, ContextoUsuario.oUsuario.ID_EMPRESA, vFgProgramaModificado);
                string      vMensaje   = vResultado.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE;

                if (ptipo == "Editar")
                {
                    UtilMensajes.MensajeResultadoDB(rwmMensaje, vMensaje, vResultado.CL_TIPO_ERROR, pCallBackFunction: "ReturnDataToParentEdit");
                }
                else
                {
                    UtilMensajes.MensajeResultadoDB(rwmMensaje, vMensaje, vResultado.CL_TIPO_ERROR, pCallBackFunction: "ReturnDataToParent");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            vClUsuario  = ContextoUsuario.oUsuario.CL_USUARIO;
            vNbPrograma = ContextoUsuario.nbPrograma;
            vIdRol      = ContextoUsuario.oUsuario.oRol.ID_ROL;

            if (!IsPostBack)
            {
                vFgProgramaModificado = false;
                ProgramaNegocio nPrograma = new ProgramaNegocio();
                ptipo = Request.QueryString["TIPO"];

                vCompetencias = new List <E_PROGRAMA_COMPETENCIA>();
                vEmpleados    = new List <E_PROGRAMA_EMPLEADO>();
                vProgramas    = new List <E_PROGRAMA_CAPACITACION>();

                if (ptipo.Equals("Editar"))
                {
                    vIdPrograma = int.Parse((Request.QueryString["ID"]));
                    XElement vProgramaCapacitacion = nPrograma.ObtenerProgramaCapacitacionCompleto(vIdPrograma, ContextoUsuario.oUsuario.ID_EMPRESA);

                    SeguridadProcesos();

                    if (vProgramaCapacitacion != null)
                    {
                        cargarProgramaCapacitacion(vProgramaCapacitacion);

                        txtClProgCapacitacion.Text     = pProgramaCapacitacion.CL_PROGRAMA.ToString();
                        txtEstadoProgCapacitacion.Text = pProgramaCapacitacion.CL_ESTADO.ToString();
                        txtNbProgCapacitacion.Text     = pProgramaCapacitacion.NB_PROGRAMA.ToString();
                        if (pProgramaCapacitacion.CL_TIPO_PROGRAMA.ToString() == "A partir de 0")
                        {
                            rbCero.Checked  = true;
                            rbCopia.Enabled = false;
                            rbDnc.Enabled   = false;
                        }
                        else if (pProgramaCapacitacion.CL_TIPO_PROGRAMA.ToString() == "Desde DNC")
                        {
                            rbCero.Enabled  = false;
                            rbCopia.Enabled = false;
                            rbDnc.Checked   = true;
                            desdeDNC.Style.Add("display", "block");
                            lstPeriodo.Items.Add((vPeriodo.CL_PERIODO != null) ? new RadListBoxItem(vPeriodo.CL_PERIODO, vPeriodo.ID_PERIODO.ToString()) : vNoSeleccionado);
                            lstPeriodo.Items.FirstOrDefault().Selected = true;
                            btnBuscarPeriodo.Enabled   = false;
                            btnEliminarPeriodo.Enabled = false;
                        }
                        else if (pProgramaCapacitacion.CL_TIPO_PROGRAMA.ToString() == "Copia")
                        {
                            rbCopia.Visible = true;
                            rbCero.Enabled  = false;
                            rbCopia.Checked = true;
                            rbDnc.Enabled   = false;
                        }

                        //  txtTipoProgCapacitacion.Text = pProgramaCapacitacion.CL_TIPO_PROGRAMA.ToString();
                        valdarDsNotas();
                    }
                }
                else if (ptipo.Equals("Copy"))
                {
                    vIdPrograma = int.Parse((Request.QueryString["ID"]));
                    XElement vProgramaCapacitacion = nPrograma.ObtenerProgramaCapacitacionCompleto(vIdPrograma, ContextoUsuario.oUsuario.ID_EMPRESA);

                    if (vProgramaCapacitacion != null)
                    {
                        cargarProgramaCapacitacion(vProgramaCapacitacion);
                        rbCopia.Visible = true;
                        rbCopia.Checked = true;
                        rbDnc.Enabled   = false;
                        rbCero.Enabled  = false;
                        // txtTipoProgCapacitacion.Text = "Copia";
                        txtEstadoProgCapacitacion.Text = "Elaborando";
                    }
                }
                else
                {
                    rbDnc.Checked = true;
                    desdeDNC.Style.Add("display", "block");
                    txtEstadoProgCapacitacion.Text = new string(CharsToTitleCase(E_ESTADO_PROGRAMA_CAPACITACION.ELABORANDO.ToString()).ToArray());
                    lstPeriodo.Items.Add(vNoSeleccionado);
                    //  txtTipoProgCapacitacion.Text = "A partir de 0";
                }
            }
        }
Пример #5
0
        protected void grdPrograma_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            ProgramaNegocio neg = new ProgramaNegocio();

            grdPrograma.DataSource = neg.ObtieneProgramasCapacitacion();
        }