public static List <Models.TareaBitacora> getBitacoraTarea(string nPT)
    {
        BLL.TareaBitacora cTarea = new BLL.TareaBitacora();
        try
        {
            List <Models.TareaBitacora> lPTs = null;
            lPTs = cTarea.Catalogo(int.Parse(nPT));

            cTarea.Dispose();
            return(lPTs);
        }
        catch (Exception ex)
        {
            if (cTarea != null)
            {
                cTarea.Dispose();
            }
            throw ex;
        }
        finally
        {
            cTarea.Dispose();
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Head.PreCss = Session["strServer"].ToString() + "Capa_Presentacion/IAP30/css/IAP30.css";
        //Recogida de parámetros y volcado en IB.vars

        string sEstadoProy = "";

        DBConn DBConn = new DBConn();

        IB.sqldblib.SqlServerSP cDblib = DBConn.dblibclass;

        BLL.TareaBitacora     oTarea_BLL    = new BLL.TareaBitacora(cDblib);
        BLL.ProyectoEconomico oEstadoPE_BLL = new BLL.ProyectoEconomico(cDblib);
        BLL.AccionT           oAccion_BLL   = new BLL.AccionT(cDblib);
        try
        {
            string sIdUser = Session["NUM_EMPLEADO_IAP"].ToString();
            //sNodo = SUPER.Capa_Negocio.Estructura.getDefCorta(SUPER.Capa_Negocio.Estructura.sTipoElem.NODO);

            string    script1 = "IB.vars.codUsu = '" + sIdUser + "';";
            Hashtable ht      = Utils.ParseQuerystring(Request.QueryString.ToString());
            if (ht["idAccion"].ToString() != "")
            {
                script1 += "IB.vars.idAccion = '" + ht["idAccion"].ToString() + "';";
                if (ht["idAsunto"] != null && ht["idAsunto"].ToString() != "")
                {
                    script1 += "IB.vars.idAsunto = '" + ht["idAsunto"].ToString() + "';";
                }
                else
                {
                    //script1 += "IB.vars.idAsunto = '';";
                    Models.AccionT oAccion = new Models.AccionT();
                    oAccion  = oAccion_BLL.Select(int.Parse(ht["idAccion"].ToString()));
                    script1 += "IB.vars.idAsunto = '" + oAccion.T600_idasunto.ToString() + "';";
                }
            }
            else
            {
                script1 += "IB.vars.idAccion = '';";
                if (ht["idAsunto"] != null && ht["idAsunto"].ToString() != "")
                {
                    script1 += "IB.vars.idAsunto = '" + ht["idAsunto"].ToString() + "';";
                }
                else
                {
                    script1 += "IB.vars.idAsunto = '';";
                }
            }

            if (ht["p"].ToString() != "")
            {
                script1 += "IB.vars.permiso = '" + ht["p"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.permiso = '';";
            }

            if (ht["ori"] != null && ht["ori"].ToString() != "")
            {
                script1 += "IB.vars.origen = '" + ht["ori"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.origen = '';";
            }


            if (ht["idTarea"] != null && ht["idTarea"].ToString() != "")
            {
                script1 += "IB.vars.idTarea = '" + ht["idTarea"].ToString() + "';";

                // Obtener el nodo de la tarea
                //Models.NodoTarea oNodoTarea = new Models.NodoTarea();
                //oNodoTarea = oNodoTarea_BLL.Select(int.Parse(ht["idTarea"].ToString()));
                //script1 += "IB.vars.idNodo = '" + oNodoTarea.t303_idnodo + "';";

                //Obtengo datos de la tarea
                Models.TareaBitacora oTarea = new Models.TareaBitacora();
                oTarea      = oTarea_BLL.Select(int.Parse(ht["idTarea"].ToString()));
                script1    += "IB.vars.idNodo = '" + oTarea.cod_une.ToString() + "';";
                script1    += "IB.vars.nPE = '" + oTarea.cod_pe.ToString() + "';";
                script1    += "IB.vars.estadoProyecto = '" + oTarea.t301_estado + "';";
                script1    += "IB.vars.desPE = '" + oTarea.nom_pe + "';";
                script1    += "IB.vars.nPSN = '" + oTarea.t305_idproyectosubnodo.ToString() + "';";
                script1    += "IB.vars.nPT = '" + oTarea.cod_pt.ToString() + "';";
                script1    += "IB.vars.desPT = '" + oTarea.nom_pt + "';";
                script1    += "IB.vars.desTarea = '" + oTarea.nom_tarea + "';";
                script1    += "IB.vars.fase = '" + oTarea.nom_fase + "';";
                script1    += "IB.vars.actividad = '" + oTarea.nom_actividad + "';";
                sEstadoProy = oTarea.t301_estado;
            }
            else
            {
                script1 += "IB.vars.idTarea = '';";
                script1 += "IB.vars.idNodo = '';";
                if (ht["nPE"].ToString() != "")
                {
                    script1 += "IB.vars.nPE = '" + ht["nPE"].ToString() + "';";
                    // Obtener el estado del proyecto económico
                    Models.ProyectoEconomico oEstadoPE = new Models.ProyectoEconomico();
                    oEstadoPE   = oEstadoPE_BLL.Select(int.Parse(ht["nPE"].ToString()));
                    script1    += "IB.vars.estadoProyecto = '" + oEstadoPE.t301_estado + "';";
                    sEstadoProy = oEstadoPE.t301_estado;
                }
                else
                {
                    script1 += "IB.vars.nPE = '';";
                }

                if (ht["desPE"].ToString() != "")
                {
                    script1 += "IB.vars.desPE = '" + ht["desPE"].ToString() + "';";
                }
                else
                {
                    script1 += "IB.vars.desPE = '';";
                }

                if (ht["nPSN"].ToString() != "")
                {
                    script1 += "IB.vars.nPSN = '" + ht["nPSN"].ToString() + "';";
                }
                else
                {
                    script1 += "IB.vars.nPSN = '';";
                }

                if (ht["nPT"].ToString() != "")
                {
                    script1 += "IB.vars.nPT = '" + ht["nPT"].ToString() + "';";
                }
                else
                {
                    script1 += "IB.vars.nPT = '';";
                }

                if (ht["desPT"].ToString() != "")
                {
                    script1 += "IB.vars.desPT = '" + ht["desPT"].ToString() + "';";
                }
                else
                {
                    script1 += "IB.vars.desPT = '';";
                }
                if (ht["desTarea"].ToString() != "")
                {
                    script1 += "IB.vars.desTarea = '" + ht["desTarea"].ToString() + "';";
                }
                else
                {
                    script1 += "IB.vars.desTarea = '';";
                }

                if (ht["fase"].ToString() != "")
                {
                    script1 += "IB.vars.fase = '" + ht["fase"].ToString() + "';";
                }
                else
                {
                    script1 += "IB.vars.fase = '';";
                }

                if (ht["actividad"].ToString() != "")
                {
                    script1 += "IB.vars.actividad = '" + ht["actividad"].ToString() + "';";
                }
                else
                {
                    script1 += "IB.vars.actividad = '';";
                }
            }

            script1 += "IB.vars.IdResponsable = '';";
            script1 += "IB.vars.fechaDia = '" + DateTime.Now.ToShortDateString() + "';";
            script1 += "IB.vars.idEmpleadoEntrada = '" + Session["NUM_EMPLEADO_ENTRADA"].ToString() + "';";
            script1 += "IB.vars.nombreEmpleadoEntrada = '" + Session["APELLIDO1"].ToString() + " " + Session["APELLIDO2"].ToString() + ", " + Session["NOMBRE"].ToString() + "';";

            //Modo en el se accederá al contenedor de documentos --> Edición o Consulta
            string sModoContainer = ht["p"].ToString();
            if (sModoContainer != "E")
            {
                sModoContainer = "C";
            }
            else
            {
                if (sEstadoProy == "C" || sEstadoProy == "H")
                {
                    sModoContainer = "C";
                }
            }
            script1 += "IB.vars.superEditor = '" + Utilidades.EsAdminProduccion() + "';";
            script1 += "IB.vars.sModoContainer = '" + sModoContainer + "';";
            script1 += "IB.vars.idResponsable = '" + Session["NUM_EMPLEADO_ENTRADA"].ToString() + "';";

            script1 += "IB.vars.bCambios = 0;";
            //parametros para poder volver a la pantalla de imputación
            script1 += "IB.vars.qs = '" + Request.QueryString.ToString() + "';";
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script1", script1, true);

            //ObtenerDatosAsunto();
        }
        catch (Exception ex)
        {
            LogError.LogearError("Parámetros incorrectos en la carga de la pantalla", ex);

            string script2 = "IB.vars.error = 'Parámetros incorrectos en la carga de la pantalla';";
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script2", script2, true);
        }

        finally
        {
            oTarea_BLL.Dispose();
            oEstadoPE_BLL.Dispose();
            oAccion_BLL.Dispose();
            DBConn.Dispose();
        }
    }
    private Models.TareaBitacora ponerDatosTarea(string sIdT)
    {
        BLL.TareaBitacora    Tarea  = new BLL.TareaBitacora();
        Models.TareaBitacora oTarea = new Models.TareaBitacora();
        oTarea.sAccesoBitacora = "X";
        try
        {
            int idT = int.Parse(sIdT);

            oTarea = Tarea.Select(idT);
            this.idProyecto.Value   = oTarea.cod_pe.ToString("#,###");
            this.desProyecto.Value  = oTarea.nom_pe;
            this.idPT.Value         = oTarea.cod_pt.ToString("#,###");
            this.desProyectoT.Value = oTarea.nom_pt;
            this.fase.Value         = oTarea.nom_fase;
            this.actividad.Value    = oTarea.nom_actividad;
            this.idTarea.Value      = idT.ToString("#,###");
            this.tareaDes.Value     = oTarea.nom_tarea;
            #region Comprobación de permiso de acceso. Lo comento para solo mirar el permiso a nivel de tarea
            //if (oTarea.t305_accesobitacora_pst != "X")
            //{
            //    if (oTarea.t331_acceso_iap != "X")
            //    {
            //        if (oTarea.t332_acceso_iap != "X")
            //        {
            //            if (oTarea.t301_estado == "C" || oTarea.t301_estado == "H")
            //                this.hdnAcceso.Value = "L";
            //            else
            //            {
            //                if (oTarea.t305_accesobitacora_pst == "L")
            //                    this.hdnAcceso.Value = "L";
            //                else
            //                {
            //                    if (oTarea.t331_acceso_iap == "L")
            //                        this.hdnAcceso.Value = "L";
            //                    else
            //                        this.hdnAcceso.Value = oTarea.t332_acceso_iap;
            //                }
            //            }
            //        }
            //        else
            //            throw new Exception("La tarea no permite el acceso a bitácora desde IAP.");
            //    }
            //    else
            //        throw new Exception("El proyecto técnico no permite el acceso a bitácora desde IAP.");
            //}
            //else
            //    throw new Exception("El proyecto económico no permite el acceso a bitácora desde IAP.");
            #endregion
            if (oTarea.t332_acceso_iap != "X")
            {
                if (oTarea.t301_estado == "C" || oTarea.t301_estado == "H")
                {
                    oTarea.sAccesoBitacora = "L";
                }
                else
                {
                    oTarea.sAccesoBitacora = oTarea.t332_acceso_iap;
                }
            }
            else
            {
                throw new Exception("La tarea no permite el acceso a bitácora desde IAP.");
            }
        }
        catch (Exception ex)
        {
            LogError.LogearError("Parámetros incorrectos en la carga de la pantalla", ex);

            string script2 = "IB.vars['error'] = 'Parámetros incorrectos en la carga de la pantalla';";
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script2", script2, true);
        }
        finally
        {
            Tarea.Dispose();
        }
        return(oTarea);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Head.PreCss = Session["strServer"].ToString() + "Capa_Presentacion/IAP30/css/IAP30.css";
        DBConn DBConn = new DBConn();

        IB.sqldblib.SqlServerSP cDblib     = DBConn.dblibclass;
        BLL.TareaBitacora       oTarea_BLL = new BLL.TareaBitacora(cDblib);

        try
        {
            Hashtable ht = Utils.ParseQuerystring(Request.QueryString.ToString());
            //Variables de sesión
            string script1 = "IB.vars.superEditor = '" + Utilidades.EsAdminProduccion() + "';";
            //script1 += "IB.vars.codUsu = '" + Session["NUM_EMPLEADO_IAP"].ToString() + "';";

            if (ht["idAsunto"] != null && ht["idAsunto"].ToString() != "")
            {
                script1 += "IB.vars.idAsunto = '" + ht["idAsunto"].ToString() + "';";
            }
            if (ht["idAccion"] != null && ht["idAccion"].ToString() != "")
            {
                script1 += "IB.vars.idAccion = '" + ht["idAccion"].ToString() + "';";
            }

            if (ht["idTarea"] != null && ht["idTarea"].ToString() != "")
            {
                script1 += "IB.vars.idTarea = '" + ht["idTarea"].ToString() + "';";
                Models.TareaBitacora oTarea = new Models.TareaBitacora();
                oTarea = oTarea_BLL.Select(int.Parse(ht["idTarea"].ToString()));
                this.hdnIdProyectoSubNodo.Value = oTarea.t305_idproyectosubnodo.ToString();
                script1 += "IB.vars.idNodo = '" + oTarea.cod_une.ToString() + "';";
                script1 += "IB.vars.nPE = '" + oTarea.cod_pe.ToString() + "';";
                script1 += "IB.vars.estadoProyecto = '" + oTarea.t301_estado + "';";
                script1 += "IB.vars.desPE = '" + oTarea.nom_pe + "';";
                script1 += "IB.vars.nPSN = '" + oTarea.t305_idproyectosubnodo.ToString() + "';";
                script1 += "IB.vars.nPT = '" + oTarea.cod_pt.ToString() + "';";
                script1 += "IB.vars.desPT = '" + oTarea.nom_pt + "';";
                script1 += "IB.vars.desTarea = '" + oTarea.nom_tarea + "';";
                script1 += "IB.vars.fase = '" + oTarea.nom_fase + "';";
                script1 += "IB.vars.actividad = '" + oTarea.nom_actividad + "';";
            }
            else
            {
                if (ht["nPSN"] != null && ht["nPSN"].ToString() != "")
                {
                    script1 += "IB.vars.nPSN = '" + ht["nPSN"].ToString() + "';";
                    script1 += "IB.vars.txtProy = '" + ht["txtProy"].ToString() + "';";
                    this.hdnIdProyectoSubNodo.Value = ht["nPSN"].ToString();
                }
                else
                {
                    script1 += "IB.vars.nPSN = '';";
                    script1 += "IB.vars.txtProy = '';";
                }
            }
            if (ht["conACC"] != null && ht["conACC"].ToString() != "" && ht["conACC"].ToString() == "S")
            {
                this.chkConAcciones.Checked = true;
            }
            if (ht["auto"] != null && ht["auto"].ToString() != "" && ht["auto"].ToString() == "S")
            {
                this.chkAutomatica.Checked = true;
            }
            if (ht["tipo"] != null && ht["tipo"].ToString() != "")
            {
                //this.cboTipo.Value = ht["tipo"].ToString();
                script1 += "IB.vars.tipo = '" + ht["tipo"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.tipo = '';";
            }
            if (ht["estado"] != null && ht["estado"].ToString() != "")
            {
                this.cboEstado.Value = ht["estado"].ToString();
            }
            if (ht["severidad"] != null && ht["severidad"].ToString() != "")
            {
                this.cboSeveridad.Value = ht["severidad"].ToString();
            }
            if (ht["prio"] != null && ht["prio"].ToString() != "")
            {
                this.cboPrioridad.Value = ht["prio"].ToString();
            }
            if (ht["denom"] != null && ht["denom"].ToString() != "")
            {
                this.txtDenominacion.Value = ht["denom"].ToString();
            }
            if (ht["notifD"] != null && ht["notifD"].ToString() != "")
            {
                script1 += "IB.vars.notifD = '" + ht["notifD"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.notifD = '';";
            }
            if (ht["notifH"] != null && ht["notifH"].ToString() != "")
            {
                script1 += "IB.vars.notifH = '" + ht["notifH"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.notifH = '';";
            }

            if (ht["limiteD"] != null && ht["limiteD"].ToString() != "")
            {
                script1 += "IB.vars.limiteD = '" + ht["limiteD"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.limiteD = '';";
            }
            if (ht["limiteH"] != null && ht["limiteH"].ToString() != "")
            {
                script1 += "IB.vars.limiteH = '" + ht["limiteH"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.limiteH = '';";
            }

            if (ht["finD"] != null && ht["finD"].ToString() != "")
            {
                script1 += "IB.vars.finD = '" + ht["finD"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.finD = '';";
            }
            if (ht["finH"] != null && ht["finH"].ToString() != "")
            {
                script1 += "IB.vars.finH = '" + ht["finH"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.finH = '';";
            }

            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script1", script1, true);
        }
        catch (Exception ex)
        {
            LogError.LogearError("Parámetros incorrectos en la carga de la pantalla", ex);

            string script2 = "IB.vars['error'] = 'Parámetros incorrectos en la carga de la pantalla';";
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script2", script2, true);
        }
        finally
        {
            oTarea_BLL.Dispose();
            DBConn.Dispose();
        }
    }