private string buscarPT(string t331_idpt)
    {
        StringBuilder sb = new StringBuilder();

        try
        {
            ProyTec o = ProyTec.Obtener(int.Parse(t331_idpt));
            if (o.t331_idpt.ToString() != "")
            {
                sb.Append(o.t305_idproyectosubnodo.ToString() + "@#@");
                sb.Append(o.num_proyecto.ToString() + "@#@");
                sb.Append(o.nom_proyecto + "@#@");
                sb.Append(o.t331_despt);
            }

            return("OK@#@" + sb.ToString());;
        }
        catch (Exception ex)
        {
            return("AVISO@#@El proyecto técnico no existe o no está bajo tu ámbito de visión");
        }
    }
Ejemplo n.º 2
0
    private void ObtenerDatosAsunto()
    {
        //Relleno el combo de tipo de asunto
        this.cboTipo.DataValueField = "t384_idtipo";
        this.cboTipo.DataTextField  = "t384_destipo";
        this.cboTipo.DataSource     = TIPOASUNTO.Catalogo("", null, null, 3, 0);
        this.cboTipo.DataBind();

        if (nIdAsunto == -1)
        {
            txtValCre.Text             = DateTime.Now.ToShortDateString();
            txtValNotif.Text           = DateTime.Now.ToShortDateString();
            this.txtIdResponsable.Text = Session["NUM_EMPLEADO_ENTRADA"].ToString();
            this.txtResponsable.Text   = Session["APELLIDO1"].ToString() + " " + Session["APELLIDO2"].ToString() + ", " + Session["NOMBRE"].ToString();
            this.txtRegistrador.Text   = Session["APELLIDO1"].ToString() + " " + Session["APELLIDO2"].ToString() + ", " + Session["NOMBRE"].ToString();
        }
        else
        {
            ASUNTO_PT o = ASUNTO_PT.Select(tr, nIdAsunto);
            txtIdAsunto.Text    = o.t409_idasunto.ToString();
            txtDesAsunto.Text   = o.t409_desasunto;
            txtDescripcion.Text = o.t409_desasuntolong;
            this.txtEtp.Text    = o.t409_etp.ToString("N");
            this.txtEtr.Text    = o.t409_etr.ToString("N");
            if (o.t409_fcreacion.Year > 1900)
            {
                txtValCre.Text = o.t409_fcreacion.ToShortDateString();
            }
            if (o.t409_fnotificacion.Year > 1900)
            {
                txtValNotif.Text = o.t409_fnotificacion.ToShortDateString();
            }
            if (o.t409_flimite.Year > 1900)
            {
                txtValLim.Text = o.t409_flimite.ToShortDateString();
            }
            if (o.t409_ffin.Year > 1900)
            {
                txtValFin.Text = o.t409_ffin.ToShortDateString();
            }
            this.txtDpto.Text               = o.t409_dpto;
            this.txtAlerta.Text             = o.t409_alerta;
            this.txtObs.Text                = o.t409_obs;
            this.txtRefExt.Text             = o.t409_refexterna;
            this.txtSistema.Text            = o.t409_sistema;
            this.cboEstado.SelectedValue    = o.t409_estado.ToString();
            this.cboEstado.Text             = o.Estado;
            this.txtEstadoAnt.Text          = o.t409_estado.ToString();
            this.cboPrioridad.SelectedValue = o.t409_prioridad.ToString();
            this.cboPrioridad.Text          = o.Prioridad;
            this.cboSeveridad.SelectedValue = o.t409_severidad.ToString();
            this.cboSeveridad.Text          = o.Severidad;
            this.cboTipo.SelectedValue      = o.t384_idtipo.ToString();
            this.cboTipo.Text               = o.Tipo;
            this.txtNotificador.Text        = o.t409_notificador;
            this.txtIdResponsable.Text      = o.t409_responsable.ToString();
            this.txtResponsable.Text        = o.Responsable;
            this.txtRegistrador.Text        = o.Registrador;
        }

        ProyTec         oPT  = ProyTec.Obtener(nIdPT);
        PROYECTOSUBNODO oPSN = PROYECTOSUBNODO.Obtener(null, oPT.t305_idproyectosubnodo);

        if (oPSN.t305_opd)
        {
            lblNumero.Style.Add("display", "none");
            txtIdAsunto.Style.Add("display", "none");
            lblCreacion.Style.Add("visibility", "hidden");
            txtValCre.Style.Add("visibility", "hidden");
            tsPestanas.Items[1].Disabled = true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsCallback)
        {
            if (Session["IDRED"] == null)
            {
                try
                {
                    Response.Redirect("~/SesionCaducadaModal.aspx", true);
                }
                catch (System.Threading.ThreadAbortException) { return; }
            }
            if (!Page.IsPostBack)
            {
                try
                {
                    LimpiarDatos();
                    //origen
                    if (Request.QueryString["o"] != null)
                    {
                        sOrigen = Utilidades.decodpar(Request.QueryString["o"].ToString());
                    }
                    //sAccBitacoraPT
                    if (Request.QueryString["b"] != null)
                    {
                        sAccesoBitacoraPT = Utilidades.decodpar(Request.QueryString["b"].ToString());
                    }
                    //if (Request.QueryString["sAccBitacora"] != null)
                    //    sAccBitacora = Request.QueryString["sAccBitacora"].ToString();
                    if (Request.QueryString["psn"] != null)
                    {
                        nPSN = int.Parse(Utilidades.decodpar(Request.QueryString["psn"].ToString()));
                    }
                    else
                    {
                        if (Session["ID_PROYECTOSUBNODO"].ToString() != "")
                        {
                            nPSN = int.Parse(Session["ID_PROYECTOSUBNODO"].ToString());
                        }
                    }
                    //Código de proyecto técnico
                    if (Request.QueryString["pt"] != null)
                    {
                        this.txtIdPT.Text  = Utilidades.decodpar(Request.QueryString["pt"].ToString());
                        this.txtDesPT.Text = Utilidades.decodpar(Request.QueryString["npt"].ToString());
                        ProyTec oPT = ProyTec.Obtener(int.Parse(this.txtIdPT.Text));
                        nPSN = oPT.t305_idproyectosubnodo;
                    }
                    if (nPSN > -1)
                    {
                        this.hdnT305IdProy.Value = nPSN.ToString();
                        string        sModoAcceso = PROYECTOSUBNODO.getAcceso(null, nPSN, (int)Session["UsuarioActual"]);
                        SqlDataReader dr          = PROYECTO.fgGetDatosProy(nPSN);
                        if (dr.Read())
                        {
                            //sAccesoBitacoraPT = dr["t305_accesobitacora_pst"].ToString();
                            if (sAccesoBitacoraPT != "X")
                            {
                                this.txtEstado.Text  = dr["t301_estado"].ToString();
                                this.txtNomProy.Text = dr["t301_denominacion"].ToString();
                                this.txtCodProy.Text = int.Parse(dr["t301_idproyecto"].ToString()).ToString("#,###");
                                if (sModoAcceso == "R")
                                {
                                    sAccesoBitacoraPT = "L";
                                }
                                else
                                {
                                    if (this.txtEstado.Text == "C" || this.txtEstado.Text == "H")
                                    {
                                        sAccesoBitacoraPT = "L";
                                    }
                                }
                            }
                        }
                        dr.Close();
                        dr.Dispose();
                        switch (this.txtEstado.Text)
                        {
                        case "A":
                            imgEstProy.ImageUrl = "~/images/imgIconoProyAbierto.gif";
                            imgEstProy.Attributes.Add("title", "Proyecto abierto");
                            break;

                        case "C":
                            imgEstProy.ImageUrl = "~/images/imgIconoProyCerrado.gif";
                            imgEstProy.Attributes.Add("title", "Proyecto cerrado");
                            break;

                        case "P":
                            imgEstProy.ImageUrl = "~/images/imgIconoProyPresup.gif";
                            imgEstProy.Attributes.Add("title", "Proyecto presupuestado");
                            break;

                        case "H":
                            imgEstProy.ImageUrl = "~/images/imgIconoProyHistorico.gif";
                            imgEstProy.Attributes.Add("title", "Proyecto histórico");
                            break;
                        }
                        if (sAccesoBitacoraPT != "X" && this.txtIdPT.Text != "")
                        {
                            //ObtenerDatosAsunto(int.Parse(quitaPuntos(this.txtIdPT.Text)));
                            obtenerAsuntos(quitaPuntos(this.txtIdPT.Text), "8", "0", 0, 0);
                            ObtenerDatosTs(int.Parse(this.txtIdPT.Text));
                        }
                    }
                    //Relleno el combo de tipo de asunto
                    this.cboTipo.DataValueField = "t384_idtipo";
                    this.cboTipo.DataTextField  = "t384_destipo";
                    this.cboTipo.DataSource     = TIPOASUNTO.Catalogo("", null, null, 3, 0);
                    this.cboTipo.DataBind();
                }
                catch (Exception ex)
                {
                    sErrores = Errores.mostrarError("Error al obtener los datos", ex);
                }
            }

            //1º Se indican (por este orden) la función a la que se va a devolver el resultado
            //   y la función que va a acceder al servidor
            string cbRespuesta = Page.ClientScript.GetCallbackEventReference(this, "arg", "RespuestaCallBack", "context", false);
            string cbLlamada   = "function RealizarCallBack(arg, context)" + "{" + cbRespuesta + ";" + "}";

            //2º Se "registra" la función que va a acceder al servidor.
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RealizarCallBack", cbLlamada, true);
        }
    }