public static List <Models.ProyectoEconomico> obtenerProyectos(Nullable <int> idNodo, string sEstado, string sCategoria, Nullable <int> idCliente, Nullable <int> idResponsable, Nullable <int> numPE, string sDesPE, string sTipoBusqueda, string sCualidad, Nullable <int> nContrato, Nullable <int> nHorizontal,
                                                                   Nullable <int> nCNP, Nullable <int> nCSN1P, Nullable <int> nCSN2P, Nullable <int> nCSN3P, Nullable <int> nCSN4P, Nullable <int> nModeloContratacion)
    {
        BLL.ProyectoEconomico ProyectoEconomicoBLL = new BLL.ProyectoEconomico();

        try
        {
            List <Models.ProyectoEconomico> lProyectoEconomico = null;

            lProyectoEconomico = ProyectoEconomicoBLL.Catalogo(Utilidades.EsAdminProduccion(), idNodo, sEstado, sCategoria, idCliente, idResponsable, numPE, sDesPE, sTipoBusqueda, sCualidad, nContrato, nHorizontal, nCNP, nCSN1P, nCSN2P, nCSN3P, nCSN4P, false, false, (int)HttpContext.Current.Session["NUM_EMPLEADO_IAP"], false, null, nModeloContratacion);
            return(lProyectoEconomico);
        }
        catch (Exception ex)
        {
            LogError.LogearError("Error al obtener los proyectos", ex);
            throw new Exception(System.Uri.EscapeDataString("Error al obtener los proyectos"));
        }
        finally
        {
            ProyectoEconomicoBLL.Dispose();
        }
    }
Exemple #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.NodoPT            oNodoPT_BLL   = new BLL.NodoPT(cDblib);
        BLL.ProyectoEconomico oEstadoPE_BLL = new BLL.ProyectoEconomico(cDblib);
        BLL.AccionPT          oAccion_BLL   = new BLL.AccionPT(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["ori"] != null && ht["ori"].ToString() != "")
            {
                script1 += "IB.vars.origen = '" + ht["ori"].ToString() + "';";
            }
            else
            {
                script1 += "IB.vars.origen = '';";
            }

            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.AccionPT oAccion = new Models.AccionPT();
                    oAccion  = oAccion_BLL.Select(int.Parse(ht["idAccion"].ToString()));
                    script1 += "IB.vars.idAsunto = '" + oAccion.T409_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["nPE"] != null && 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 = '';";
                script1 += "IB.vars.estadoProyecto = '';";
            }


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

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

                // Obtener el nodo del proyecto técnico
                Models.NodoPT oNodoPT = new Models.NodoPT();

                oNodoPT  = oNodoPT_BLL.Select(int.Parse(ht["nPT"].ToString()));
                script1 += "IB.vars.idNodo = '" + oNodoPT.t303_idnodo + "';";
            }
            else
            {
                script1 += "IB.vars.nPT = '';";
                script1 += "IB.vars.idNodo = '';";
            }


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

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


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

            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
        {
            oNodoPT_BLL.Dispose();
            oEstadoPE_BLL.Dispose();
            oAccion_BLL.Dispose();
            DBConn.Dispose();
        }
    }