Exemplo n.º 1
0
    private void ObtenerDatosAsunto()
    {
        int nTarea = 0;

        //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)
        {
            nTarea                     = nIdT;
            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_T o = ASUNTO_T.Select(tr, nIdAsunto);
            nTarea              = o.t332_idtarea;
            txtIdAsunto.Text    = o.t600_idasunto.ToString();
            txtDesAsunto.Text   = o.t600_desasunto;
            txtDescripcion.Text = o.t600_desasuntolong;
            this.txtEtp.Text    = o.t600_etp.ToString("N");
            this.txtEtr.Text    = o.t600_etr.ToString("N");//#,##0.##
            if (o.t600_fcreacion.Year > 1900)
            {
                txtValCre.Text = o.t600_fcreacion.ToShortDateString();
            }
            if (o.t600_fnotificacion.Year > 1900)
            {
                txtValNotif.Text = o.t600_fnotificacion.ToShortDateString();
            }
            if (o.t600_flimite.Year > 1900)
            {
                txtValLim.Text = o.t600_flimite.ToShortDateString();
            }
            if (o.t600_ffin.Year > 1900)
            {
                txtValFin.Text = o.t600_ffin.ToShortDateString();
            }
            this.txtDpto.Text               = o.t600_dpto;
            this.txtAlerta.Text             = o.t600_alerta;
            this.txtObs.Text                = o.t600_obs;
            this.txtRefExt.Text             = o.t600_refexterna;
            this.txtSistema.Text            = o.t600_sistema;
            this.cboEstado.SelectedValue    = o.t600_estado.ToString();
            this.cboEstado.Text             = o.Estado;
            this.txtEstadoAnt.Text          = o.t600_estado.ToString();
            this.cboPrioridad.SelectedValue = o.t600_prioridad.ToString();
            this.cboPrioridad.Text          = o.Prioridad;
            this.cboSeveridad.SelectedValue = o.t600_severidad.ToString();
            this.cboSeveridad.Text          = o.Severidad;
            this.cboTipo.SelectedValue      = o.t384_idtipo.ToString();
            this.cboTipo.Text               = o.Tipo;
            this.txtNotificador.Text        = o.t600_notificador;
            this.txtIdResponsable.Text      = o.t600_responsable.ToString();
            this.txtResponsable.Text        = o.Responsable;
            this.txtRegistrador.Text        = o.Registrador;
        }

        TAREAPSP        oTarea = TAREAPSP.Obtener(null, nTarea);
        PROYECTOSUBNODO oPSN   = PROYECTOSUBNODO.Obtener(null, oTarea.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 (!(bool)Session["FORANEOS"])
            //{
            //    this.imgForaneo.Visible = false;
            //    this.lblForaneo.Visible = false;
            //}
            sErrores = "";
            sLectura = "false";
            sNodo = Estructura.getDefCorta(Estructura.sTipoElem.NODO);
            nIdAccion = int.Parse(Utilidades.decodpar(Request.QueryString["a"].ToString()));//nIdAccion
            txtIdAsunto.Text = Utilidades.decodpar(Request.QueryString["as"].ToString());//idAsunto
            //txtDesAsunto.Text = Utilidades.unescape(Request.QueryString["desAsunto"].ToString());
            ASUNTO_T oAsto = ASUNTO_T.Select(null, int.Parse(txtIdAsunto.Text));
            txtDesAsunto.Text = oAsto.t600_desasunto;
            this.hdnAcceso.Text = Utilidades.decodpar(Request.QueryString["p"].ToString());//Permiso

            nIdT = int.Parse(quitaPuntos(Request.QueryString["t"].ToString()));//nT

            //this.txtIdResponsable.Text = Request.QueryString["sIdResp"].ToString();
            this.txtIdResponsable.Text = oAsto.t600_responsable.ToString();
            //if (Request.QueryString["r"] != null && Request.QueryString["r"] != "undefined")//sIdResp
            //{
            //    if (Request.QueryString["r"] != "")
            //        this.txtIdResponsable.Text = Utilidades.decodpar(Request.QueryString["r"].ToString());
            //}

            this.hdnNodo.Value = TAREAPSP.GetNodo(tr, nIdT).ToString();
            try
            {
                Utilidades.SetEventosFecha(this.txtValLim);
                Utilidades.SetEventosFecha(this.txtValFin);

                ObtenerDatosAccion();
            }
            catch (Exception ex)
            {
                sErrores += Errores.mostrarError("Error al obtener los datos de la acción", ex);
            }
            try
            {
                //Datos de las personas asignadas a la acción
                string strTabla = ObtenerRecursos(nIdAccion.ToString(), this.hdnNodo.Value);
                string[] aRecursos = Regex.Split(strTabla, "@#@");
                if (aRecursos[0] == "OK") divR.InnerHtml = aRecursos[1];

                //Datos de los documentos asociados a la acción
                //strTabla = ObtenerDocumentos(nIdAccion.ToString());
                //string[] aTabla = Regex.Split(strTabla, "@#@");
                //if (aTabla[0] == "OK") divDoc.InnerHtml = aTabla[1];
                string sEstado = TAREAPSP.getEstado(null, nIdT);
                divDoc.InnerHtml = Utilidades.ObtenerDocumentos("AC_T", nIdAccion, this.hdnAcceso.Text, sEstado);
            }
            catch (Exception ex)
            {
                sErrores += Errores.mostrarError("Error al obtener datos complementarios", ex);
            }

            this.hdnAcceso.Text = Utilidades.decodpar(Request.QueryString["p"].ToString());//Permiso
            if (this.hdnAcceso.Text == "R")
            {
                ModoLectura.Poner(this.Controls);
                sLectura = "true";
            }
            //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);
        }
    }