private string getTarea1(string sTarea)
    {
        StringBuilder sb = new StringBuilder();
        string        sId;

        try
        {
            TAREAPSP oTar = TAREAPSP.Obtener(null, int.Parse(sTarea.Replace(".", "")));
            sb.Append("<div style='background-image:url(../../../../Images/imgFT16.gif); width: 460px;'>");
            sb.Append("<table id='tblOpciones' class='texto MANO' style='width: 460px;' mantenimiento='0'>");
            sb.Append("<colgroup><col style='width: 460px;' /></colgroup>");
            sb.Append("<tbody>");
            if (oTar.t332_idtarea != 0)
            {
                sId = oTar.t332_idtarea.ToString();
                sb.Append("<tr id='" + sId + "' onclick='ms(this);getRecursos(this.id)' style='height:16px'");
                sb.Append(" style='noWrap:true;' title=\"cssbody=[dvbdy] cssheader=[dvhdr] ");
                sb.Append("header=[<img src='../../../../images/info.gif' style='vertical-align:middle' />  Información] body=[");
                sb.Append("<label style='width:60px'>P.T.&nbsp;:</label>" + oTar.t331_despt.Replace((char)34, (char)39));
                sb.Append("<br><label style='width:60px'>Fase&nbsp;:</label>" + oTar.t334_desfase.Replace((char)34, (char)39));
                sb.Append("<br><label style='width:60px'>Actividad&nbsp;:</label>" + oTar.t335_desactividad.Replace((char)34, (char)39));
                sb.Append("<br><label style='width:60px'>Tarea&nbsp;:</label>" + int.Parse(sId).ToString("#,###"));
                sb.Append(" " + oTar.t332_destarea.Replace((char)34, (char)39) + "] hideselects=[off]\">");
                sb.Append("<td style='padding-left:3px;'><nobr class='NBR W445'>" + oTar.t332_destarea + "</nobr></td>");
                sb.Append("</tr>");
            }
            sb.Append("</tbody>");
            sb.Append("</table></div>");
            return("OK@#@" + oTar.t332_destarea + "@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la tarea ", ex));
        }
    }
    private string ObtenerDatosTs(int nPT)
    {
        string        sResul = "";
        SqlDataReader dr;

        try
        {
            StringBuilder sb    = new StringBuilder();
            int           iUser = (int)Session["UsuarioActual"];
            sb.Append("<table id='tblTs' class='texto MA' style='width:305px;'>");
            sb.Append("<tbody>");
            dr = TAREAPSP.CatalogoBitacora(nPT);
            while (dr.Read())
            {
                sb.Append("<tr id='" + dr["cod_tarea"].ToString() + "' aIAP='" + dr["t332_acceso_iap"].ToString() + "'");
                sb.Append(" style='height:16px;' onclick='ms(this)' ondblclick='bitacoraT(this.id)'>");
                sb.Append("<td><nobr class='NBR' style='width:300px; padding-left:3px;'>" + int.Parse(dr["cod_tarea"].ToString()).ToString("#,###") + "-" +
                          HttpUtility.HtmlEncode(dr["nom_tarea"].ToString()) + "</nobr>");
                sb.Append("</td></tr>");
            }
            dr.Close();
            dr.Dispose();
            sb.Append("</tbody>");
            sb.Append("</table>");
            strTablaHtmlTs = sb.ToString();
            sResul         = strTablaHtmlTs;
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al obtener las tareas", ex);
        }
        return(sResul);
    }
    private string buscarTarea(string sIdTarea)
    {
        string        sResul  = "";
        StringBuilder sb      = new StringBuilder();
        int           idTarea = int.Parse(sIdTarea);

        try
        {
            TAREAPSP oTar = TAREAPSP.Obtener(null, idTarea);
            if (oTar.t332_destarea != "")
            {
                sb.Append(oTar.t305_idproyectosubnodo + "##");
                sb.Append(oTar.t303_idnodo + "##");
                sb.Append(oTar.t301_estado + "##");
                sb.Append(oTar.num_proyecto.ToString("#,###") + "##");
                sb.Append(oTar.nom_proyecto + "##");
                sb.Append(oTar.t331_idpt + "##");
                sb.Append(oTar.t331_despt + "##");
                sb.Append(oTar.t334_idfase + "##");
                sb.Append(oTar.t334_desfase + "##");
                sb.Append(oTar.t335_idactividad + "##");
                sb.Append(oTar.t335_desactividad + "##");
                sb.Append(idTarea.ToString("#,###") + "##");
                sb.Append(oTar.t332_destarea + "///");
            }

            sResul = "OK@#@" + sb.ToString();
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al buscar la tarea", ex);
        }
        return(sResul);
    }
    private void ObtenerDatosTarea()
    {
        TAREAPSP o = TAREAPSP.ObtenerDatosRecurso(null, nIdTarea, int.Parse(Session["NUM_EMPLEADO_IAP"].ToString()));

        txtNumPE.Text     = o.num_proyecto.ToString("#,###");
        txtPE.Text        = o.nom_proyecto;
        txtPT.Text        = o.t331_despt;
        txtFase.Text      = o.t334_desfase;
        txtActividad.Text = o.t335_desactividad;

        txtIdTarea.Text     = o.t332_idtarea.ToString("#,###");
        txtDesTarea.Text    = o.t332_destarea;
        txtDescripcion.Text = o.t332_destarealong;

        txtPriCon.Text = (o.dPrimerConsumo.HasValue)? ((DateTime)o.dPrimerConsumo).ToShortDateString():"";
        txtUltCon.Text = (o.dPrimerConsumo.HasValue) ? ((DateTime)o.dUltimoConsumo).ToShortDateString() : "";
        txtConHor.Text = o.nConsumidoHoras.ToString("N");
        txtConJor.Text = o.nConsumidoJornadas.ToString("N");
        txtPteEst.Text = o.nPendienteEstimado.ToString("N");
        if (o.nAvanceTeorico > -1)
        {
            txtAvanEst.Text = o.nAvanceTeorico.ToString("N");
        }
        if (o.t336_etp > 0)
        {
            txtTotPre.Text = o.t336_etp.ToString("N");
        }
        txtFinPre.Text       = (o.t336_ffp.HasValue)? ((DateTime)o.t336_ffp).ToShortDateString() : "";
        txtIndicaciones.Text = o.t336_indicaciones;
        txtColectivas.Text   = o.t332_mensaje;

        if (o.t336_ete > 0)
        {
            txtTotEst.Text = o.t336_ete.ToString("N");
        }
        txtFinEst.Text     = (o.t336_ffe.HasValue) ? ((DateTime)o.t336_ffe).ToShortDateString() : "";
        txtComentario.Text = o.t336_comentario;

        if (o.nCompletado == 1)
        {
            chkFinalizada.Checked = true;
        }

        txtNotas1.Text = o.t332_notas1;
        txtNotas2.Text = o.t332_notas2;
        txtNotas3.Text = o.t332_notas3;
        txtNotas4.Text = o.t332_notas4;

        if (!o.t332_notasiap)
        {
            tsPestanas.Items[2].Disabled = true;
        }
        else
        {
            sNotas = "1";
        }
    }
    private void getTarea(string sIdTarea)
    {
        int idTarea = int.Parse(sIdTarea);

        try
        {
            TAREAPSP oTar = TAREAPSP.Obtener(null, idTarea);
            if (oTar.t332_destarea != "")
            {
                this.hdnT305IdProy.Value = oTar.t305_idproyectosubnodo.ToString();
                this.txtEstado.Text      = oTar.t301_estado;
                if (this.txtEstado.Text == "C" || this.txtEstado.Text == "H")
                {
                    sAccesoBitacoraT = "L";
                }
                this.txtNomProy.Text = oTar.nom_proyecto;
                this.txtCodProy.Text = oTar.num_proyecto.ToString("#,###");
                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;
                }
                this.hdnIdPT.Text        = oTar.t331_idpt.ToString();
                this.txtDesPT.Text       = oTar.t331_despt;
                this.hdnIdFase.Text      = oTar.t334_idfase.ToString();
                this.txtFase.Text        = oTar.t334_desfase;
                this.hdnIdActividad.Text = oTar.t335_idactividad.ToString();
                this.txtActividad.Text   = oTar.t335_desactividad;
                this.txtIdTarea.Text     = idTarea.ToString("#,###");
                this.txtDesTarea.Text    = oTar.t332_destarea.Replace("<", " ");
            }
        }
        catch (Exception ex)
        {
            Errores.mostrarError("Error al buscar la tarea", ex);
        }
    }
Ejemplo n.º 6
0
        private void obtenerListaTareas(int nIdPSN, int nRTPT)
        {
            StringBuilder sb   = new StringBuilder();
            SqlDataReader dr   = null;
            string        sAux = "";

            if (nRTPT == 0)
            {
                dr = TAREAPSP.CatalogoFFPRmenorFFPL(nIdPSN);
            }
            else
            {
                dr = TAREAPSP.CatalogoFFPRmenorFFPL(nIdPSN, int.Parse(Session["UsuarioActual"].ToString()));
            }
            sb.Append("<table id='tblDatos' class='texto' style='width: 800px;'>");
            sb.Append("<colgroup><col style='width: 150px;' />");
            sb.Append("<col style='width: 100px;' />");
            sb.Append("<col style='width: 100px;' />");
            sb.Append("<col style='width: 60px; ' />");
            sb.Append("<col style='width: 270px; ' />");
            sb.Append("<col style='width: 60px;' />");
            sb.Append("<col style='width: 60px;' />");
            sb.Append("</colgroup>");
            //sb.Append("<tbody>");
            while (dr.Read())
            {
                sb.Append("<tr><td title='" + dr["t331_despt"].ToString() + "'><nobr class='NBR W150'>" + dr["t331_despt"].ToString() + "</nobr></td>");
                sb.Append("<td title='" + dr["t334_desfase"].ToString() + "'><nobr class='NBR W100'>" + dr["t334_desfase"].ToString() + "</nobr></td>");
                sb.Append("<td title='" + dr["t335_desactividad"].ToString() + "'><nobr class='NBR W100'>" + dr["t335_desactividad"].ToString() + "</nobr></td>");
                sb.Append("<td style='text-align:right; padding-right:3px;'>" + int.Parse(dr["t332_idtarea"].ToString()).ToString("#,###") + "</td>");
                sb.Append("<td style='padding-left:2px;'title='" + dr["t332_destarea"].ToString() + "'><nobr class='NBR W268'>" + dr["t332_destarea"].ToString() + "</nobr></td>");

                sAux = dr["t332_ffpl"].ToString();
                if (sAux != "")
                {
                    sAux = sAux.Substring(0, 10);
                }
                sb.Append("<td>" + sAux + "</td>");

                sAux = dr["t332_ffpr"].ToString();
                if (sAux != "")
                {
                    sAux = sAux.Substring(0, 10);
                }
                sb.Append("<td>" + sAux + "</td></tr>");
            }
            dr.Close();
            dr.Dispose();
            //sb.Append("</tbody>");
            sb.Append("</table>");
            divC.InnerHtml = sb.ToString();
        }
    private string PonerRecurso(string sTipoItem, int IdRecurso, int nIdTarea, bool bNotifProf)
    {
        SqlConnection  oConn  = null;
        SqlTransaction tr     = null;
        string         sResul = "";

        //bool bAdmiteRecursoPST = true, bRecursoAsignado = false;
        try
        {
            //Abro transaccion
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccion(oConn);

            //bRecursoAsignado = TareaRecurso.InsertarTEC(tr, nIdTarea, IdRecurso, null, null, null, null, null, null, 1, null, "", false,
            //                                            bAdmiteRecursoPST, IdPsn, IdNodo, iUltCierreEco);
            int iRes = TareaRecurso.InsertarSNE(tr, nIdTarea, IdRecurso, null, null, null, null, null, null, 1, "", "", false);

            if (bNotifProf && iRes != 0)//se notifica a profesionales y no estaba ya asignado a la tarea
            {
                TAREAPSP oTar  = TAREAPSP.Obtener(null, nIdTarea);
                TAREAPSP oTar2 = TAREAPSP.ObtenerOTC(null, nIdTarea);
                string   oRec  = "##" + nIdTarea.ToString() + "##" + IdRecurso.ToString() + "################";
                oRec += Utilidades.escape(oTar.t332_destarea) + "##";
                oRec += oTar.num_proyecto.ToString() + "##" + Utilidades.escape(oTar.nom_proyecto) + "##";
                oRec += Utilidades.escape(oTar.t331_despt) + "##" + Utilidades.escape(oTar.t334_desfase) + "##" + Utilidades.escape(oTar.t335_desactividad) + "##";
                oRec += Utilidades.escape(oTar2.t346_codpst) + "##" + Utilidades.escape(oTar2.t346_despst) + "##";
                oRec += Utilidades.escape(oTar.t332_otl) + "##" + Utilidades.escape(oTar.t332_incidencia) + "##";

                TareaRecurso.EnviarCorreoRecurso(tr, "I", oRec, "", "", "", "", Utilidades.escape(oTar.t332_mensaje));
            }
            Conexion.CommitTransaccion(tr);
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = Errores.mostrarError("Error al grabar", ex);
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }
        return(sResul);
    }
    private string Permiso(string sT305IdProy, string sCodUne, string sNumProyEco, string sIdTarea)
    {
        string sResul = "N", sEstProy;

        try
        {
            //1º miramos si hay acceso sobre la tarea
            string sUserAct = Session["UsuarioActual"].ToString();
            int    iUserAct = int.Parse(sUserAct);
            sIdTarea = sIdTarea.Replace(".", "");
            sResul   = TAREAPSP.getAcceso(null, int.Parse(sIdTarea), iUserAct);
            //N-> no hay acceso R-> acceso en lectura W-> acceso en escritura
            if (sResul != "N")
            {
                //Miramos el estado del proyecto economico. Por que si está cerrado aunque tenga permiso solo se podrá leer
                sEstProy = EstrProy.estadoProyecto(sT305IdProy);
                if (sEstProy == "C" || sEstProy == "H")
                {
                    if (sResul == "W")
                    {
                        sResul = "R";
                    }
                }
                if (sResul == "R")
                {
                    ModoLectura.Poner(this.Controls);
                }
            }
            gsAcceso            = sResul;
            this.hdnAcceso.Text = sResul;
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al obtener permisos sobre la tarea " + sIdTarea, ex);
        }
        //return "OK@#@" + sResul;
        return(sResul);
    }
Ejemplo n.º 9
0
    private string ObtenerDatosTarea(string sIdTarea, string sIDUsuario)
    {
        StringBuilder sb = new StringBuilder();

        try
        {
            TAREAPSP o = TAREAPSP.ObtenerDatosRecurso(null, int.Parse(sIdTarea), int.Parse(sIDUsuario));

            sb.Append(o.t324_idmodofact.ToString() + "@#@");                                                           //2
            sb.Append(o.t324_denominacion.ToString() + "@#@");                                                         //3
            sb.Append((o.dPrimerConsumo.HasValue) ? ((DateTime)o.dPrimerConsumo).ToShortDateString() + "@#@" : "@#@"); //4
            sb.Append((o.dUltimoConsumo.HasValue) ? ((DateTime)o.dUltimoConsumo).ToShortDateString() + "@#@" : "@#@"); //5
            sb.Append(o.nConsumidoHoras.ToString("N") + "@#@");                                                        //6
            sb.Append(o.nConsumidoJornadas.ToString("N") + "@#@");                                                     //7
            sb.Append(o.nPendienteEstimado.ToString("N") + "@#@");                                                     //8
            sb.Append((o.nAvanceTeorico > -1) ? o.nAvanceTeorico.ToString("N") + "@#@" : "@#@");                       //9
            sb.Append((o.t336_etp > 0) ? o.t336_etp.ToString("N") + "@#@" : "@#@");                                    //10
            sb.Append((o.t336_ffp.HasValue) ? ((DateTime)o.t336_ffp).ToShortDateString() + "@#@" : "@#@");             //11
            sb.Append(Utilidades.escape(o.t336_indicaciones.ToString()) + "@#@");                                      //12
            sb.Append(Utilidades.escape(o.t332_mensaje.ToString()) + "@#@");                                           //13
            sb.Append((o.t336_ete > 0) ? o.t336_ete.ToString("N") + "@#@" : "@#@");                                    //14
            sb.Append((o.t336_ffe.HasValue) ? ((DateTime)o.t336_ffe).ToShortDateString() + "@#@" : "@#@");             //15
            sb.Append(Utilidades.escape(o.t336_comentario.ToString()) + "@#@");                                        //16
            sb.Append((o.nCompletado == 1) ? "1@#@" : "0@#@");                                                         //17
            sb.Append(o.num_proyecto.ToString("#,###") + " - " + o.t305_seudonimo + "@#@");                            //18
            sb.Append(o.t331_despt + "@#@");                                                                           //19
            sb.Append(o.t334_desfase + "@#@");                                                                         //20
            sb.Append(o.t335_desactividad + "@#@");                                                                    //21


            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("No se han obtenido los datos de la tarea:", ex));
        }
    }
Ejemplo n.º 10
0
    private void ObtenerDatos(int nTarea)
    {
        StringBuilder sb = new StringBuilder();

        sb.Append("<table id='tblDatos' style='width: 780px;'>");
        sb.Append("<colgroup>");
        sb.Append("<col style='width:130px;' />");
        sb.Append("<col style='width:370px;' />");
        sb.Append("<col style='width:70px;' />");
        sb.Append("<col style='width:70px;' />");
        sb.Append("<col style='width:70px;' />");
        sb.Append("<col style='width:70px;' />");
        sb.Append("</colgroup>");
        sb.Append("<tbody>");

        SqlDataReader dr = TAREAPSP.ObtenerAuditoriaPrevisiones(nTarea);


        while (dr.Read())
        {
            sb.Append("<tr style='height:16px' ");
            sb.Append(" onmouseover='TTip(event)'>");
            sb.Append("<td style='text-align:center;'>" + dr["t499_cuando"].ToString() + "</td>");
            sb.Append("<td style='padding-left:2px;'><nobr class='NBR W240'>" + dr["Quien"].ToString() + "</nobr></td>");
            sb.Append("<td style='text-align:center;'>" + dr["t499_valorantiguo_ffpr"].ToString() + "</td>");
            sb.Append("<td style='text-align:center;'>" + dr["t499_valornuevo_ffpr"].ToString() + "</td>");
            sb.Append("<td style='padding-right:2px; text-align:right;'>" + dr["t499_valorantiguo_etpr"].ToString() + "</td>");
            sb.Append("<td style='padding-right:2px; text-align:right;'>" + dr["t499_valornuevo_etpr"].ToString() + "</td>");
            sb.Append("</tr>");
        }
        dr.Close();
        dr.Dispose();
        sb.Append("</tbody>");
        sb.Append("</table>");

        strTablaHTML = sb.ToString();
    }
    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; }
            }

            //txtDesTarea.Attributes["maxlength"] = "100";
            nIdTarea   = int.Parse(Utilidades.decodpar(Request.QueryString["t"].ToString()));
            nObligaest = int.Parse(Utilidades.decodpar(Request.QueryString["nObligaest"].ToString()));
            nPT        = int.Parse(Utilidades.decodpar(Request.QueryString["pt"].ToString()));
            sDesTarea  = Utilidades.decodpar(Request.QueryString["sDesTarea"].ToString());

            try
            {
                Utilidades.SetEventosFecha(this.txtFinEst);

                ObtenerDatosTarea();
            }
            catch (Exception ex)
            {
                sErrores += Errores.mostrarError("Error al obtener los datos de la tarea", ex);
            }

            try
            {
                //string strTabla = ObtenerDocumentos(nIdTarea.ToString());
                //string[] aTabla = Regex.Split(strTabla, "@#@");
                //if (aTabla[0] == "OK") divCatalogoDoc.InnerHtml = aTabla[1];

                string sEstadoProy = TAREAPSP.getEstado(null, nIdTarea);
                string sPermiso    = "E";
                if (bEstadoLectura)
                {
                    sPermiso = "R";
                }
                div1.InnerHtml = Utilidades.ObtenerDocumentos("IAP_T", nIdTarea, sPermiso, sEstadoProy);
            }
            catch (Exception ex)
            {
                sErrores += Errores.mostrarError("Error al obtener los datos de la tarea", ex);
            }

            sEstado     = Utilidades.decodpar(Request.QueryString["estado"]);
            sImputacion = Utilidades.decodpar(Request.QueryString["imputacion"]);
            switch (sEstado) //Estado
            {
            case "0":        //Paralizada
                bEstadoLectura = true;
                break;

            case "1":    //Activo
                break;

            case "2":    //Pendiente
                bEstadoLectura = true;
                break;

            case "3":    //Finalizada
                if (sImputacion == "0")
                {
                    bEstadoLectura = true;
                }
                break;

            case "4":    //Cerrada
                if (sImputacion == "0")
                {
                    bEstadoLectura = true;
                }
                break;
            }
            if (bEstadoLectura)
            {
                ModoLectura.Poner(this.Controls);
            }

            //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);
        }
    }
    protected string Grabar(string sCopias, string slTareas)
    {
        string   sIdTarea, sResul = "", sDesTarea = "";
        int      nIdTarea, iUsuario, nIdTareaNew;
        short    nOrden = 0, nCopias = 0;
        byte     nEstado = 1;
        DateTime?dValIni = null;
        DateTime?dValFin = null;
        DateTime?dPLIni  = null;
        DateTime?dPLFin  = null;
        DateTime?dPRFin  = null;

        #region abrir conexión y transacción
        try
        {
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccion(oConn);
        }
        catch (Exception ex)
        {
            if (oConn.State == ConnectionState.Open)
            {
                Conexion.Cerrar(oConn);
            }
            sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex);
            return(sResul);
        }
        #endregion
        try
        {
            iUsuario = int.Parse(Session["NUM_EMPLEADO_ENTRADA"].ToString());
            nCopias  = short.Parse(sCopias);
            string[] aTarea = Regex.Split(slTareas, "##");
            for (int i = 0; i < aTarea.Length; i++)
            {
                sIdTarea = aTarea[i];
                if ((sIdTarea != "") && (sIdTarea != "0"))
                {
                    nIdTarea = int.Parse(sIdTarea);
                    TAREAPSP oTarea = TAREAPSP.Obtener(tr, nIdTarea);
                    nOrden = TAREAPSP.flCalcularOrden2(null, oTarea.t331_idpt);
                    //Por defecto la nueva tarea estará activa salvo que la original esté pendiente
                    if (oTarea.t332_estado == 2)
                    {
                        nEstado = 2;
                    }
                    else
                    {
                        nEstado = 1;
                    }
                    if (oTarea.t332_fiv.ToString() != "")
                    {
                        dValIni = oTarea.t332_fiv;
                    }
                    if (oTarea.t332_ffv.ToString() != "")
                    {
                        dValFin = oTarea.t332_ffv;
                    }
                    if (oTarea.t332_fipl.ToString() != "")
                    {
                        dPLIni = oTarea.t332_fipl;
                    }
                    if (oTarea.t332_ffpl.ToString() != "")
                    {
                        dPLFin = oTarea.t332_ffpl;
                    }
                    if (oTarea.t332_ffpr.ToString() != "")
                    {
                        dPRFin = oTarea.t332_ffpr;
                    }
                    for (short j = 1; j <= nCopias; j++)
                    {
                        sDesTarea = "Copia " + j.ToString() + " de " + oTarea.t332_destarea;
                        if (sDesTarea.Length > 100)
                        {
                            sDesTarea = sDesTarea.Substring(1, 100);
                        }
                        nIdTareaNew = TAREAPSP.Insert(tr
                                                      , sDesTarea                                         //Des. tarea;
                                                      , oTarea.t332_destarealong                          //Des. larga de tarea;
                                                      , oTarea.t331_idpt                                  //Id PT
                                                      , oTarea.t335_idactividad                           //IdActividad
                                                      , iUsuario                                          //promotor
                                                      , iUsuario                                          //último modificador
                                                      , DateTime.Now                                      //F.Alta
                                                      , DateTime.Now                                      //F.Ultima modificacion
                                                      , dValIni                                           //F.Inicio Vigencia
                                                      , dValFin                                           //F.Fin vigencia
                                                      , nEstado                                           //estado
                                                      , dPLIni                                            //F.Inicio Planificada
                                                      , dPLFin                                            //F.Fin Planificada
                                                      , oTarea.t332_etpl                                  //Esfuerzo total estimado
                                                      , dPRFin                                            //F.Fin Prevista
                                                      , oTarea.t332_etpr                                  //Esfuerzo total previsto
                                                      , null                                              //PST
                                                      , oTarea.t332_cle                                   //Control límite de esfuerzos
                                                      , oTarea.t332_tipocle                               //tipo de control de límite de esfuerzo
                                                      , nOrden                                            //orden
                                                      , oTarea.t332_facturable                            //facturable
                                                      , decimal.Parse(oTarea.t332_presupuesto.ToString()) //presupuesto
                                                      , null,                                             //24
                                                      "",                                                 //OTL
                                                      "",                                                 //INCIDENCIA
                                                      "",                                                 //OBSERVACIONES
                                                      oTarea.t332_notificable,                            //notificabled
                                                      "",                                                 //NOTAS1
                                                      "",                                                 //NOTAS2
                                                      "",                                                 //NOTAS3
                                                      "",                                                 //NOTAS4
                                                      oTarea.t332_avance,                                 //avance real
                                                      oTarea.t332_avanceauto,                             //avance automatico (true/false)
                                                      oTarea.t332_impiap,                                 //imputable en IAP (true/false)
                                                      false,                                              //notas IAP
                                                      oTarea.t332_heredanodo,                             //recursos heredados del nodo
                                                      oTarea.t332_heredaproyeco,                          //recursos heredados del PE
                                                      "",                                                 //mesaje generico para todos los profesionales
                                                      oTarea.t332_notif_prof                              //Notificar a profesionales asociados
                                                      , oTarea.t332_acceso_bitacora_iap
                                                      , null                                              //pendiente ultimo null modo facturación
                                                      , oTarea.t332_horascomplementarias);
                        POOL_GF_TAREA.DuplicarPoolGF(tr, nIdTarea, nIdTareaNew);
                        //Asigno lo atributos estadístico que tuviera la tarea original
                        AETAREAPSP.DuplicarAEs(tr, nIdTarea, nIdTareaNew);
                    } //For copias
                }     //IF
            }         //FOR
            Conexion.CommitTransaccion(tr);

            sResul = "OK@#@";
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = "Error@#@" + Errores.mostrarError("Error al grabar los datos de la tarea", ex);
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }
        return(sResul);
    }
    private string Procesar(string sNumPSN, string sRTPT, string sParalizada, string sActiva, string sPendiente, string sFinalizada, string sFecIniVig, string sFecFinVig)
    {
        bool     bParalizada = false, bActiva = false, bPendiente = false, bFinalizada = false, bRTPT = false;
        DateTime?dIniV = null;
        DateTime?dFinV = null;

        string sResul           = "";
        int    iTareasAfectadas = 0;

        #region abrir conexión y transacción
        try
        {
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccion(oConn);
        }
        catch (Exception ex)
        {
            if (oConn.State == ConnectionState.Open)
            {
                Conexion.Cerrar(oConn);
            }
            sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex);
            return(sResul);
        }
        #endregion

        try
        {
            if (sRTPT == "1")
            {
                bRTPT = true;
            }
            if (sParalizada == "1")
            {
                bParalizada = true;
            }
            if (sActiva == "1")
            {
                bActiva = true;
            }
            if (sPendiente == "1")
            {
                bPendiente = true;
            }
            if (sFinalizada == "1")
            {
                bFinalizada = true;
            }
            if (sFecIniVig != "")
            {
                dIniV = DateTime.Parse(sFecIniVig);
            }
            if (sFecFinVig != "")
            {
                dFinV = DateTime.Parse(sFecFinVig);
            }

            iTareasAfectadas = TAREAPSP.Cierre(tr, int.Parse(sNumPSN), (int)Session["UsuarioActual"], bRTPT, bParalizada, bActiva, bPendiente, bFinalizada, dIniV, dFinV);
            Conexion.CommitTransaccion(tr);
            sResul = "OK@#@" + iTareasAfectadas.ToString();
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = "error@#@Error al actualizar los estados de las tareas del proyecto subnodo " + sNumPSN + "\n\n" + ex.Message;
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }
        return(sResul);
    }
    private string PonerRecurso(bool bSoloAsignadas, bool bSoloActivas, int iRecursoOrigen, string sTipoItem, int IdRecurso, int IdItem,
                                string sHaciaProy, int IdNodo, int iUltCierreEco, int IdPsn, bool bNotifProf)
    {
        SqlConnection  oConn = null;
        SqlTransaction tr = null;
        string         sResul = "";
        bool           bAdmiteRecursoPST, bRecursoAsignado = false;

        try
        {
            if (sHaciaProy == "S")
            {
                bAdmiteRecursoPST = true;
            }
            else
            {
                bAdmiteRecursoPST = false;
            }
            //Abro transaccion
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccion(oConn);

            switch (sTipoItem)
            {
            case "E":
                PROYECTOSUBNODO.AsignarTareasProfesional(tr, bSoloAsignadas, bSoloActivas, iRecursoOrigen, IdItem, IdRecurso, null, null,
                                                         -1, "", false, bAdmiteRecursoPST, IdNodo, iUltCierreEco);
                break;

            case "P":
                ProyTec.AsignarTareasProfesional(tr, bSoloAsignadas, bSoloActivas, iRecursoOrigen, IdItem, IdRecurso, null, null, -1, "", false, bAdmiteRecursoPST, IdPsn, IdNodo, iUltCierreEco);
                break;

            case "F":
                FASEPSP.AsignarTareasProfesional(tr, bSoloAsignadas, bSoloActivas, iRecursoOrigen, IdItem, IdRecurso, null, null, -1, "", false, bAdmiteRecursoPST, IdPsn, IdNodo, iUltCierreEco);
                break;

            case "A":
                ACTIVIDADPSP.AsignarTareasProfesional(tr, bSoloAsignadas, bSoloActivas, iRecursoOrigen, IdItem, IdRecurso, null, null, -1, "", false, bAdmiteRecursoPST, IdPsn, IdNodo, iUltCierreEco);
                break;

            case "T":
                //iNumAsig = TareaRecurso.InsertarSNE(tr, IdItem, IdRecurso, null, null, null, null, null, null, 1, null, "", false);
                bRecursoAsignado = TareaRecurso.InsertarTEC(tr, IdItem, IdRecurso, null, null, null, null, null, null, 1, null, "", false,
                                                            bAdmiteRecursoPST, IdPsn, IdNodo, iUltCierreEco);
                if (bNotifProf && bRecursoAsignado)    //se notifica a profesionales y no estaba ya asignado a la tarea
                {
                    TAREAPSP oTar  = TAREAPSP.Obtener(null, IdItem);
                    TAREAPSP oTar2 = TAREAPSP.ObtenerOTC(null, IdItem);
                    string   oRec  = "##" + IdItem.ToString() + "##" + IdRecurso.ToString() + "################";
                    oRec += Utilidades.escape(oTar.t332_destarea) + "##";
                    oRec += oTar.num_proyecto.ToString() + "##" + Utilidades.escape(oTar.nom_proyecto) + "##";
                    oRec += Utilidades.escape(oTar.t331_despt) + "##" + Utilidades.escape(oTar.t334_desfase) + "##" + Utilidades.escape(oTar.t335_desactividad) + "##";
                    oRec += Utilidades.escape(oTar2.t346_codpst) + "##" + Utilidades.escape(oTar2.t346_despst) + "##";
                    oRec += Utilidades.escape(oTar.t332_otl) + "##" + Utilidades.escape(oTar.t332_incidencia) + "##";

                    TareaRecurso.EnviarCorreoRecurso(tr, "I", oRec, "", "", "", "", Utilidades.escape(oTar.t332_mensaje));
                }
                break;
            }
            //if (sHaciaProy == "S")
            //{
            //    if (!TareaRecurso.AsociadoAProyecto(tr, IdPsn, IdRecurso))
            //    {//lA FECHA DE alta en el proyecto será la siguiente al último mes cerrado del nodo
            //        DateTime dtFechaAlta = Fechas.AnnomesAFecha(Fechas.AddAnnomes(iUltCierreEco, 1));
            //        TareaRecurso.AsociarAProyecto(tr, IdNodo, IdRecurso, IdPsn, null, dtFechaAlta, null);
            //    }
            //    else
            //        TareaRecurso.ReAsociarAProyecto(tr, IdRecurso, IdPsn);
            //}
            Conexion.CommitTransaccion(tr);
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = Errores.mostrarError("Error al grabar", ex);
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }
        return(sResul);
    }
Ejemplo n.º 15
0
    private string Procesar(string sForzar, string sAnno, string strDatos)
    {
        string    sResul = "";
        int       nSubnodo = 0, nPE = 0, nPSN = 0;//, nDesde = 0, nHasta = 0, nAux = 0
        Hashtable htSubnodos = new Hashtable();
        Hashtable htNodos    = new Hashtable();
        NODO      oNodoAux   = null;

        int[] nDatosNodo;
        int?  idFicepiValidador = null;

        try
        {
            #region abrir conexión y transacción
            try
            {
                oConn = Conexion.Abrir();
                tr    = Conexion.AbrirTransaccionSerializable(oConn);
            }
            catch (Exception ex)
            {
                if (oConn.State == ConnectionState.Open)
                {
                    Conexion.Cerrar(oConn);
                }
                sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex);
                return(sResul);
            }
            #endregion

            string[] aProyectos = Regex.Split(strDatos, "///");
            foreach (string oProyecto in aProyectos)
            {
                if (oProyecto == "")
                {
                    continue;
                }
                string[] aValores = Regex.Split(oProyecto, "##");
                /// aValores[0] = idNodo
                /// aValores[1] = idNaturaleza
                /// aValores[2] = FIV
                /// aValores[3] = FFV
                /// aValores[4] = idPlantilla
                /// aValores[5] = Denominación Naturaleza
                /// aValores[6] = Esreplicable
                ///
                /// aValores[7] = Hereda Nodo
                /// aValores[8] = Id Usuario responsable
                /// aValores[9] = Imputable GASVI
                /// aValores[10] = Id Ficepi Validador GASVI

                if (sForzar == "N" && PROYECTOSUBNODO.ExistePIG(tr, int.Parse(aValores[0]), int.Parse(aValores[1]), short.Parse(sAnno)))
                {
                    continue;
                }
                #region Datos de nodo y subnodo
                nDatosNodo = (int[])htSubnodos[int.Parse(aValores[0])];
                if (nDatosNodo == null)
                {
                    int nCountSubnodosManiobra2  = 0;
                    int idSubnodoManiobra2       = 0;
                    int nCountSubnodosNoManiobra = 0;
                    int idSubnodoNoManiobra      = 0;

                    DataSet dsSubNodos = SUBNODO.CatalogoActivos(tr, int.Parse(aValores[0]), true);
                    foreach (DataRow oSN in dsSubNodos.Tables[0].Rows)
                    {
                        if ((byte)oSN["t304_maniobra"] == 2)
                        {
                            nCountSubnodosManiobra2++;
                            idSubnodoManiobra2 = (int)oSN["t304_idsubnodo"];
                        }
                        else if ((byte)oSN["t304_maniobra"] == 0)
                        {
                            nCountSubnodosNoManiobra++;
                            idSubnodoNoManiobra = (int)oSN["t304_idsubnodo"];
                        }
                    }
                    dsSubNodos.Dispose();

                    //nSubnodo = SUBNODO.ObtenerSubnodoManiobra2(tr, int.Parse(aValores[0]));
                    NODO oNodo = NODO.Select(tr, int.Parse(aValores[0]));

                    if (nCountSubnodosNoManiobra == 1)
                    {
                        nSubnodo = idSubnodoNoManiobra;
                    }
                    else if (nCountSubnodosManiobra2 >= 1)
                    {
                        nSubnodo = idSubnodoManiobra2;
                    }
                    else
                    {
                        nSubnodo = SUBNODO.Insert(tr, "Improductivos genéricos", int.Parse(aValores[0]), 0, true, 2, oNodo.t314_idusuario_responsable, null);
                    }
                    htSubnodos.Add(int.Parse(aValores[0]), new int[3] {
                        int.Parse(aValores[0]),
                        nSubnodo,
                        oNodo.t314_idusuario_responsable
                    });
                    nDatosNodo = (int[])htSubnodos[int.Parse(aValores[0])];
                }


                oNodoAux = (NODO)htNodos[int.Parse(aValores[0])];
                if (oNodoAux == null)
                {
                    oNodoAux = NODO.Select(tr, int.Parse(aValores[0]));
                    htNodos.Add(int.Parse(aValores[0]), oNodoAux);
                }
                #endregion
                string sDenominacion = sAnno + " " + Utilidades.unescape(aValores[5]) + " (" + oNodoAux.t303_denabreviada + ")";
                int    nIdClientePIG = CLIENTE.ObtenerClientePIG(tr, int.Parse(aValores[0]));

                nPE = PROYECTO.Insert(tr, "A", sDenominacion.Substring(0, (sDenominacion.Length > 70) ? 70 : sDenominacion.Length), "",
                                      nIdClientePIG, null, null, int.Parse(aValores[1]), 4, DateTime.Parse(aValores[2]),
                                      DateTime.Parse(aValores[3]), "S", "J", "J", short.Parse(sAnno), false, false,
                                      (aValores[6] == "1")? true:false, null, false, null, null, Constantes.gIdNLO_Defecto);

                //nPSN = PROYECTOSUBNODO.Insert(tr, nPE, nDatosNodo[1], false, "C", true, nDatosNodo[2],
                //                            sAnno + " " + Utilidades.unescape(aValores[5]),
                //                            "X", "X", false, true, false, false, false, "", "", "", null, null, null, null,
                //                            null, null, false, 0);
                //Mikel 30/12/2011. Pongo como seudónimo del subnodo la misma denominación que para el proyecto
                if (aValores[10] != "" && aValores[10] != "null")
                {
                    idFicepiValidador = int.Parse(aValores[10]);
                }
                else
                {
                    idFicepiValidador = null;
                }
                //Mikel 02/02/2016 Los PIG deben llevar el admite recurso PST a cero
                nPSN = PROYECTOSUBNODO.Insert(tr, nPE, nDatosNodo[1], false, "C", (aValores[7] == "1") ? true : false,
                                              int.Parse(aValores[8]),                        //nDatosNodo[2],//Id Usuario Responsable
                                              sDenominacion.Substring(0, (sDenominacion.Length > 70) ? 70 : sDenominacion.Length),
                                              "X", "X", (aValores[9] == "1") ? true : false, //Imputable GASVI
                                              false,                                         //Admite recurso PST
                                              false, false, false, "", "", "", null, null, null, null, null,
                                              idFicepiValidador,                             //Id Ficepi Validador GASVI
                                              false, 0);

                //A falta de tener en cuenta si la naturaleza tiene plantilla.
                TAREAPSP.UpdateVigenciaByPSN(tr, nPSN, DateTime.Parse(aValores[2]), DateTime.Parse(aValores[3]));

                #region Grabación de plantilla
                if (aValores[4] != "0")
                {
                    //Hay que grabar la plantilla de PE.
                    int       iPos, iMargen, iPT = -1, iFase = -1, iActiv = -1, iTarea = -1, iHito = -1, iAux = -1, iOrden = 0, idItemHitoPl;
                    double    fDuracion;
                    decimal   fPresupuesto;
                    string    sTipo, sDesc, sFiniPL, sFfinPL, sFiniV, sFfinV, sAux, sAvisos, sIdTareaPL, sCad;
                    bool      bFacturable, bObligaEst, bAvanceAutomatico, bEstadoTarea;
                    ArrayList alTareas = new ArrayList();

                    PROYECTOSUBNODO.BorrarPTByPSN(tr, nPSN);

                    #region 1º Se insertan las filas de la estructura
                    SqlDataReader dr = PlantTarea.Catalogo(int.Parse(aValores[4]));
                    while (dr.Read())
                    {
                        sTipo = dr["Tipo"].ToString();
                        if (sTipo == "H")
                        {
                            sTipo = "HT";
                        }
                        sDesc   = Utilidades.escape(dr["Nombre"].ToString());
                        iMargen = int.Parse(dr["margen"].ToString());

                        //Si la linea es de hito compruebo si el hito es de tarea o no para actualizar la variable iTarea
                        if (sTipo == "HT" || sTipo == "HM" || sTipo == "HF")
                        {
                            switch (iMargen)
                            {
                            case 80:    //es un hito de tarea por lo que mantengo el código de tarea
                                break;

                            case 60:    //es un hito de fase y actividad o de tarea con actividad sin fase
                                if (iFase != -1)
                                {
                                    iTarea = -1;
                                }
                                break;

                            case 40:    //es un hito de fase o de tarea sin actividad ni fase o de actividad sin fase
                                if (iFase != -1)
                                {
                                    iTarea = -1;
                                    iActiv = -1;
                                }
                                else
                                {
                                    if (iActiv != -1)
                                    {
                                        iTarea = -1;
                                    }
                                }
                                break;

                            case 20:   //es un hito proyecto técnico
                            case 0:    //es un hito de proyecto económico
                                iTarea = -1;
                                iActiv = -1;
                                iFase  = -1;
                                break;
                            }
                        }

                        fDuracion    = 0;
                        sFiniPL      = ""; //¿alguno es obligatorio?
                        sFfinPL      = "";
                        sFiniV       = Fechas.primerDiaMes(DateTime.Today).ToShortDateString();
                        sFfinV       = "";
                        fPresupuesto = 0;
                        sIdTareaPL   = dr["t339_iditems"].ToString();

                        bFacturable = (bool)dr["t339_facturable"];

                        //if (sEstado != "D")
                        iOrden++;
                        //iOrden = int.Parse(aElem[8]);
                        //Si no ha cambiado la linea pero el orden actual es distinto del original hay que updatear la linea para actualizar el orden
                        switch (sTipo)
                        {
                        case "P":
                            iPT    = -1;
                            iFase  = -1;
                            iActiv = -1;
                            break;

                        case "F":
                            iFase  = -1;
                            iActiv = -1;
                            break;

                        case "A":
                            iActiv = -1;
                            if (iMargen != 40)
                            {
                                iFase = -1;
                            }
                            break;

                        case "T":
                            iTarea = -1;
                            if (iMargen == 40)
                            {
                                iFase = -1;
                            }
                            else
                            {
                                if (iMargen != 60)
                                {
                                    iFase  = -1;
                                    iActiv = -1;
                                }
                            }
                            break;

                        case "HT":
                        case "HF":
                        case "HM":
                            iHito = -1;    //int.Parse(aElem[7]);
                            break;
                        }

                        bObligaEst        = (bool)dr["obliga"];
                        bAvanceAutomatico = (bool)dr["avance"];
                        sAux = EstrProy.Insertar(tr, int.Parse(aValores[0]), nPE, nPSN, sTipo, sDesc, iPT, iFase, iActiv, iMargen, iOrden,
                                                 sFiniPL, sFfinPL, fDuracion, sFiniV, sFfinV, fPresupuesto,
                                                 bFacturable, bObligaEst, bAvanceAutomatico, "1", "", 0);

                        iPos    = sAux.IndexOf("##");
                        iAux    = int.Parse(sAux.Substring(0, iPos));
                        sAvisos = sAux.Substring(iPos + 2);

                        switch (sTipo)
                        {
                        case "P": iPT = iAux; break;

                        case "F": iFase = iAux; break;

                        case "A": iActiv = iAux; break;

                        case "T":
                            iTarea = iAux;
                            if (sIdTareaPL != "" && sIdTareaPL != "-1")
                            {
                                string[] aDatosAux = new string[] { sIdTareaPL, iAux.ToString() };
                                alTareas.Add(aDatosAux);
                                //Grabo los atributos estadísticos provenientes de la plantilla. iAux=código de tarea
                                TAREAPSP.InsertarAE(tr, int.Parse(sIdTareaPL), iAux);
                            }

                            //Hay que guardar las tareas que quedan pendientes, ya que luego hay que actualizar el estado en pantalla
                            bEstadoTarea = TAREAPSP.bFaltanValoresAE(tr, short.Parse(aValores[0]), iAux);
                            if (bEstadoTarea)
                            {
                                //actualizo el estado de la tarea
                                TAREAPSP.Modificar(tr, iTarea, sDesc, iPT, iActiv, iOrden, sFiniPL, sFfinPL, fDuracion, sFiniV,
                                                   sFfinV, (int)Session["UsuarioActual"], fPresupuesto, 2, bFacturable);
                                //sAvisos = "Se han insertado tareas que quedan en estado Pendiente ya que el C.R. tiene atributos estadísticos\nobligatorios para los que la tarea no tiene valores asignados";
                                //if (sTareasPendientes == "") sTareasPendientes = iAux.ToString();
                                //else sTareasPendientes += "//"+ iAux.ToString();
                            }
                            break;

                        case "HT":
                            iHito = iAux;
                            break;
                        }
                        if (sTipo.Substring(0, 1) == "H")
                        {
                            AsociarTareasHitos(tr, nPSN, iPT, iFase, iActiv, iTarea, iHito, iMargen);
                        }
                    }
                    dr.Close();
                    dr.Dispose();
                    #endregion

                    #region 2º Se insertan las filas de los hitos de cumplimiento discontinuo
                    dr = PlantTarea.CatalogoHitos(int.Parse(aValores[4]));
                    while (dr.Read())
                    {
                        sTipo        = "HM";
                        sDesc        = dr["t369_deshito"].ToString();
                        idItemHitoPl = (int)dr["t369_idhito"];
                        iOrden       = int.Parse(dr["t369_orden"].ToString());

                        sAux    = EstrProy.Insertar(tr, int.Parse(aValores[0]), nPE, nPSN, sTipo, sDesc, 0, 0, 0, 0, iOrden, "", "", 0, "", "", 0, false, false, false, "1", "", 0);
                        iPos    = sAux.IndexOf("##");
                        iAux    = int.Parse(sAux.Substring(0, iPos));
                        sAvisos = sAux.Substring(iPos + 2);
                        //Si es hito de cumplimiento discontinuo y se ha cargado desde plantilla hay que grabar sus tareas
                        if (sTipo == "HM")
                        {
                            if (idItemHitoPl > 0)
                            {
                                //Recojo las tareas de plantilla del código de hito en plantilla
                                sCad = HITOE_PLANT.fgListaTareasPlantilla(tr, idItemHitoPl);
                                string[] aElems2 = Regex.Split(sCad, @"##");
                                for (int j = 0; j < aElems2.Length; j++)
                                {
                                    sIdTareaPL = aElems2[j];
                                    if (sIdTareaPL != "" && sIdTareaPL != "-1")
                                    {
                                        //Identifico el código de tarea real asociado al codigo de tarea de plantilla
                                        for (int n = 0; n < alTareas.Count; n++)
                                        {
                                            if (((string[])alTareas[n])[0] == sIdTareaPL)
                                            {//Inserto la tarea del hito
                                                sCad   = ((string[])alTareas[n])[1];
                                                iTarea = int.Parse(sCad);
                                                EstrProy.InsertarTareaHito(tr, iAux, iTarea);
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }//while
                    dr.Close();
                    dr.Dispose();
                    #endregion
                }
                #endregion
            }

            Conexion.CommitTransaccion(tr);

            sResul = "OK";
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = "Error@#@" + Errores.mostrarError("Error al crear los proyectos improductivos genéricos.", ex, false);
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }
        return(sResul);
    }
    private string ObtenerTareas(string sTipoBusqueda, string num_proy_tec, string num_fase, string num_act,
                                 string strNomTarea, string sT305IdProy)
    {
        string        sResul = "", sPT;
        int           nPT, nPE;
        SqlDataReader dr;

        try
        {
            StringBuilder strBuilder = new StringBuilder();
            // int i = 0;
            strBuilder.Append("<table id='tblDatos' class='texto MA' style='width: 440px;'>");
            strBuilder.Append("<colgroup><col style='width:440px'></colgroup>");
            strBuilder.Append("<tbody>");
            if ((sT305IdProy == "") || (sT305IdProy == "-1"))
            {
                nPE = -1;
                int iUser = (int)Session["UsuarioActual"];
                dr = TAREAPSP.Catalogo4(strNomTarea, 2, 0, sTipoBusqueda, iUser);
            }
            else
            {
                if (num_proy_tec == "")
                {
                    nPT = -1;
                }
                else
                {
                    sPT = num_proy_tec.Replace(".", "");
                    nPT = int.Parse(sPT);
                }
                if (nPT == -1)
                {
                    //sPE = sPE.Replace(".", "");
                    nPE = int.Parse(sT305IdProy);
                    int iUser = (int)Session["UsuarioActual"];
                    dr = TAREAPSP.Catalogo3(strNomTarea, nPE, 2, 0, sTipoBusqueda, iUser);
                }
                else
                {
                    if (num_fase == "" || num_fase == "-1" || num_fase == "0")
                    {
                        if (num_act == "" || num_act == "-1" || num_act == "0")
                        {
                            dr = TAREAPSP.Catalogo2(null, strNomTarea, nPT, null, null, 2, 0, sTipoBusqueda);
                        }
                        else
                        {
                            dr = TAREAPSP.Catalogo2(null, strNomTarea, nPT, null, int.Parse(num_act), 2, 0, sTipoBusqueda);
                        }
                    }
                    else
                    {
                        if (num_act == "" || num_act == "-1" || num_act == "0")
                        {
                            dr = TAREAPSP.Catalogo2(null, strNomTarea, nPT, int.Parse(num_fase), null, 2, 0, sTipoBusqueda);
                        }
                        else
                        {
                            dr = TAREAPSP.Catalogo2(null, strNomTarea, nPT, int.Parse(num_fase), int.Parse(num_act), 2, 0, sTipoBusqueda);
                        }
                    }
                }
            }
            while (dr.Read())
            {
                StringBuilder sbTitle = new StringBuilder();
                sbTitle.Append("<b>Proy. Eco.</b>: ");
                sbTitle.Append(dr["nom_proyecto"].ToString().Replace((char)34, (char)39));
                sbTitle.Append("<br><b>Proy. Téc.</b>: ");
                sbTitle.Append(dr["t331_despt"].ToString().Replace((char)34, (char)39));
                if (dr["t334_desfase"].ToString() != "")
                {
                    sbTitle.Append("<br><b>Fase</b>:          ");
                    sbTitle.Append(dr["t334_desfase"].ToString().Replace((char)34, (char)39));
                }
                if (dr["t335_desactividad"].ToString() != "")
                {
                    sbTitle.Append("<br><b>Actividad</b>:  ");
                    sbTitle.Append(dr["t335_desactividad"].ToString().Replace((char)34, (char)39));
                }
                sbTitle.Append("<br><b>Tarea</b>:  ");
                sbTitle.Append(dr["t332_destarea"].ToString().Replace((char)34, (char)39));

                strBuilder.Append("<tr id='" + dr["t332_idtarea"].ToString());
                strBuilder.Append("' nPE=\"");
                strBuilder.Append(dr["num_proyecto"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" sPE=\"");
                strBuilder.Append(dr["nom_proyecto"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" nPT=\"");
                strBuilder.Append(dr["t331_idpt"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" sPT=\"");
                strBuilder.Append(dr["t331_despt"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" nF=\"");
                strBuilder.Append(dr["t334_idfase"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" sF=\"");
                strBuilder.Append(dr["t334_desfase"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" nA=\"");
                strBuilder.Append(dr["t335_idactividad"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" sA=\"");
                strBuilder.Append(dr["t335_desactividad"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" sT305IdPr=\"");
                strBuilder.Append(dr["t305_idproyectosubnodo"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" sEst=\"");
                strBuilder.Append(dr["t301_estado"].ToString().Replace((char)34, (char)39));
                strBuilder.Append("\" onclick='ms(this);estructura(this);' onmouseover='TTip(event)' ondblclick='aceptarClick(this.rowIndex)' title=\"cssbody=[dvbdy] cssheader=[dvhdr] header=[<img src='../../../images/info.gif' style='vertical-align:middle'>  Estructura] body=[");
                strBuilder.Append(sbTitle);
                //strBuilder.Append("]\"><td><span class='NBR' style='width:400px;'>" + dr["t332_destarea"].ToString() + "</span></td></tr>");
                strBuilder.Append("]\"><td><nobr style='width:400px;'>" + dr["t332_destarea"].ToString() + "</nobr></td></tr>");
            }
            dr.Close();
            dr.Dispose();
            strBuilder.Append("</tbody>");
            strBuilder.Append("</table>");

            sResul = "OK@#@" + strBuilder.ToString();
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al Obtener las tareas", ex);
        }
        return(sResul);
    }
    private string ObtenerTareas(string sPE, string sPT, string sF, string sA)
    {// Devuelve el código HTML del catalogo de tareas
        StringBuilder sb = new StringBuilder();
        string        sDes;
        SqlDataReader rdr;

        try
        {
            if (sPT == "")
            {
                rdr = TAREAPSP.CatalogoPE(int.Parse(sPE), (int)Session["UsuarioActual"]);
            }
            else
            {
                if (sF == "")
                {
                    if (sA == "")
                    {
                        rdr = TAREAPSP.CatalogoPT(int.Parse(sPT));
                    }
                    else
                    {
                        rdr = TAREAPSP.CatalogoA(int.Parse(sA));
                    }
                }
                else
                {
                    if (sA == "")
                    {
                        rdr = TAREAPSP.CatalogoF(int.Parse(sF));
                    }
                    else
                    {
                        rdr = TAREAPSP.CatalogoA(int.Parse(sA));
                    }
                }
            }
            sb.Append("<div style='background-image:url(../../../../../Images/imgFT16.gif); width:440px;'>");
            sb.Append("<table id='tblOpciones' class='texto MAM' style='width: 440px;' mantenimiento='0'>");
            sb.Append("<colgroup><col style='width:440px' /></colgroup>");
            sb.Append("<tbody id='tBodyTareas'>");
            while (rdr.Read())
            {
                sDes = int.Parse(rdr["t332_idtarea"].ToString()).ToString("#,###") + "-" + rdr["t332_destarea"].ToString();
                sb.Append("<tr id='" + rdr["t332_idtarea"].ToString() + "' est='" + rdr["t332_estado"].ToString());
                sb.Append("' onclick='mm(event)' onmousedown='DD(event);' ");
                sb.Append("ondblclick=\"convocar(this.id,children[0].innerText,this.getAttribute('est'));\" style='height:16px'>");
                sb.Append("<td style='padding-left:5px'><label class=texto id='lbl' style='width:435px;text-overflow:ellipsis;overflow:hidden'");

                if (sDes.Length > 80)
                {
                    sb.Append(" title='" + sDes + "'");
                }

                sb.Append("><NOBR>" + sDes + "</NOBR></label></td></tr>");
            }
            sb.Append("</tbody></table></div>");
            rdr.Close(); rdr.Dispose();
            //this.strTablaHTMLPersonas = sb.ToString();
            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener las personas ", ex));
        }
    }
    private string ObtenerTareas(string sPE, string sPT, string sF, string sA)
    {// Devuelve el código HTML del catalogo de tareas
        StringBuilder sb = new StringBuilder();
        string        sId;
        SqlDataReader dr;

        try
        {
            if (sPT == "")
            {
                dr = TAREAPSP.CatalogoPE(int.Parse(sPE), (int)Session["UsuarioActual"]);
            }
            else
            {
                if (sF == "")
                {
                    if (sA == "")
                    {
                        dr = TAREAPSP.CatalogoPT(int.Parse(sPT));
                    }
                    else
                    {
                        dr = TAREAPSP.CatalogoA(int.Parse(sA));
                    }
                }
                else
                {
                    if (sA == "")
                    {
                        dr = TAREAPSP.CatalogoF(int.Parse(sF));
                    }
                    else
                    {
                        dr = TAREAPSP.CatalogoA(int.Parse(sA));
                    }
                }
            }
            sb.Append("<div style='background-image:url(../../../../Images/imgFT16.gif); width:460px'>");
            sb.Append("<table id='tblOpciones' class='texto MANO' style='width: 460px; table-layout:fixed;' mantenimiento='0'>");
            sb.Append("<colgroup><col style='width: 460px;' /></colgroup>");
            sb.Append("<tbody>");
            while (dr.Read())
            {
                sId = dr["t332_idtarea"].ToString();
                sb.Append("<tr id='" + sId + "' onClick='ms(this);getRecursos(this.id)' style='height:16px'");
                sb.Append(" style='noWrap:true;' title=\"cssbody=[dvbdy] cssheader=[dvhdr] ");
                sb.Append("header=[<img src='../../../../images/info.gif' style='vertical-align:middle' />  Información] body=[");
                sb.Append("<label style='width:60px'>P.T.&nbsp;:</label>" + dr["t331_despt"].ToString().Replace((char)34, (char)39));
                sb.Append("<br><label style='width:60px'>Fase&nbsp;:</label>" + dr["t334_desfase"].ToString().Replace((char)34, (char)39));
                sb.Append("<br><label style='width:60px'>Actividad&nbsp;:</label>" + dr["t335_desactividad"].ToString().Replace((char)34, (char)39));
                sb.Append("<br><label style='width:60px'>Tarea&nbsp;:</label>" + int.Parse(dr["t332_idtarea"].ToString()).ToString("#,###"));
                sb.Append(" " + dr["t332_destarea"].ToString().Replace((char)34, (char)39) + "] hideselects=[off]\">");
                sb.Append("<td style='padding-left:3px;'><nobr class='NBR W445'>" + dr["t332_destarea"].ToString() + "</nobr></td>");
                sb.Append("</tr>");
            }
            dr.Close();
            dr.Dispose();
            sb.Append("</tbody>");
            sb.Append("</table></div>");

            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener las tareas ", ex));
        }
    }
Ejemplo n.º 19
0
    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);
            nIdAsunto           = int.Parse(Utilidades.decodpar(Request.QueryString["as"].ToString())); //nIdAsunto
            this.hdnAcceso.Text = Utilidades.decodpar(Request.QueryString["p"].ToString());             //Permiso
            nIdT = int.Parse(quitaPuntos(Utilidades.decodpar(Request.QueryString["t"].ToString())));    //nT
            this.hdnNodo.Value = TAREAPSP.GetNodo(tr, nIdT).ToString();
            try
            {
                Utilidades.SetEventosFecha(this.txtValNotif);
                Utilidades.SetEventosFecha(this.txtValLim);
                Utilidades.SetEventosFecha(this.txtValFin);

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

                //Datos del historial del asunto
                strTabla = ObtenerHistorial(nIdAsunto.ToString());
                string[] aTareas = Regex.Split(strTabla, "@#@");
                if (aTareas[0] == "OK")
                {
                    divH.InnerHtml = aTareas[1];
                }

                //Datos de los documentos asociados al asunto
                //strTabla = ObtenerDocumentos(nIdAsunto.ToString());
                //string[] aTabla = Regex.Split(strTabla, "@#@");
                //if (aTabla[0] == "OK") divDoc.InnerHtml = aTabla[1];
                string sEstado = TAREAPSP.getEstado(null, nIdT);
                divDoc.InnerHtml = Utilidades.ObtenerDocumentos("AS_T", nIdAsunto, 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);
        }
    }
    //private string ObtenerDocumentos(string sIdTarea)
    //{
    //    StringBuilder sb = new StringBuilder();
    //    bool bModificable;
    //    SqlDataReader dr = DOCUT.Catalogo(null, int.Parse(sIdTarea), "", "", "", null, null, null, true, null, 3, 0);

    //    sb.Append("<div style='background-image:url(../../../Images/imgFT20.gif); width:0%; height:0%'>");
    //    sb.Append("<table id='tblDocumentos' class='texto' style='WIDTH: 800px; BORDER-COLLAPSE: collapse; ' cellSpacing='0' border='0'>");
    //    sb.Append("<colgroup><col style='width:265px;padding-left:5px;' /><col width='215px' /><col width='225px' /><col width='100px' /></colgroup>");
    //    sb.Append("<tbody>");
    //    while (dr.Read())
    //    {   //Si el archivo NO es sólo lectura, o si el usuario es el autor del archivo, o es administrador, se permite modificar.
    //        if ((dr["t314_idusuario_autor"].ToString() == Session["NUM_EMPLEADO_ENTRADA"].ToString() || Session["ADMINISTRADOR_PC_ACTUAL"].ToString() == "A")
    //            || (!(bool)dr["t363_privado"] && !(bool)dr["t363_modolectura"]))
    //            bModificable = true;
    //        else
    //            bModificable = false;

    //        sb.Append("<tr id='" + dr["t363_iddocut"].ToString() + "' onclick='mmse(this);' sTipo='T' sAutor='" + dr["t314_idusuario_autor"].ToString() + "' onmouseover='TTip()' style='height:20px;'>");

    //        //Si el archivo NO es sólo lectura, o si el usuario es el autor del archivo, o es administrador, se permite modificar.
    //        if (bModificable)
    //            sb.Append("<td class='MA' ondblclick=\"modificarDoc(this.parentNode.getAttribute('sTipo'), this.parentNode.id, 'IAP')\"><nobr class='NBR' style='width:255px'>" + dr["t363_descripcion"].ToString() + "</nobr></td>");
    //        else
    //            sb.Append("<td class='MANO'><nobr class='NBR' style='width:255px'>" + dr["t363_descripcion"].ToString() + "</nobr></td>");

    //        if (dr["t363_nombrearchivo"].ToString() == "")
    //        {
    //            if (bModificable)
    //                sb.Append("<td class='MA' ondblclick=\"modificarDoc(this.parentNode.getAttribute('sTipo'), this.parentNode.id)\"></td>");
    //            else
    //                sb.Append("<td class='MANO'></td>");
    //        }
    //        else
    //        {
    //            string sNomArchivo = dr["t363_nombrearchivo"].ToString() + Utilidades.TamanoArchivo((int)dr["bytes"]);
    //            //Si el archivo no es privado, o es privado y la persona que entra es el autor, o es administrador, se permite descargar.
    //            if ((!(bool)dr["t363_privado"]) || ((bool)dr["t363_privado"] && dr["t314_idusuario_autor"].ToString() == Session["NUM_EMPLEADO_ENTRADA"].ToString()) || Session["ADMINISTRADOR_PC_ACTUAL"].ToString() == "A")
    //                sb.Append("<td><img src=\"../../../images/imgDescarga.gif\" width='16px' height='16px' onclick=\"descargar(this.parentNode.parentNode.getAttribute('sTipo'), this.parentNode.parentNode.id);\" style='vertical-align:bottom;' title=\"Descargar " + sNomArchivo + "\">");
    //            else
    //                sb.Append("<td><img src=\"../../../images/imgSeparador.gif\" width='16px' height='16px' style='vertical-align:bottom;'>");
    //            if (bModificable)
    //                sb.Append("&nbsp;<nobr class='NBR MA' style='width:205px;' ondblclick=\"modificarDoc(this.parentNode.getAttribute('sTipo'), this.parentNode.id)\">" + sNomArchivo + "</nobr></td>");
    //            else
    //                sb.Append("&nbsp;<nobr class='NBR MANO' style='width:205px;'>" + sNomArchivo + "</nobr></td>");
    //        }

    //        if (dr["t363_weblink"].ToString() == "")
    //        {
    //            if (bModificable)
    //                sb.Append("<td class='MA' ondblclick=\"modificarDoc(this.parentNode.getAttribute('sTipo'), this.parentNode.id)\"></td>");
    //            else
    //                sb.Append("<td class='MANO'></td>");
    //        }
    //        else
    //        {
    //            string sHTTP = "";
    //            if (dr["t363_weblink"].ToString().IndexOf("http") == -1) sHTTP = "http://";
    //            sb.Append("<td><a href='" + sHTTP + dr["t363_weblink"].ToString() + "'><nobr class='NBR' style='width:215px'>" + dr["t363_weblink"].ToString() + "</nobr></a></td>");
    //        }
    //        if (bModificable)
    //            sb.Append("<td class='MA' ondblclick=\"modificarDoc(this.parentNode.getAttribute('sTipo'), this.parentNode.id)\"><nobr class='NBR' style='width:140px;'>" + dr["autor"].ToString() + "</nobr></td></tr>");
    //        else
    //            sb.Append("<td class='MANO'><nobr class='NBR' style='width:140px;'>" + dr["autor"].ToString() + "</nobr></td></tr>");
    //    }
    //    dr.Close();
    //    dr.Dispose();
    //    sb.Append("</tbody>");
    //    sb.Append("</table>");
    //    sb.Append("</div>");

    //    return "OK@#@" + sb.ToString();
    //}

    protected string Grabar(string strDatos)
    {
        string sResul = "";

        aListCorreo = new ArrayList();

        #region Abrir conexión y transacción
        try
        {
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccion(oConn);
        }
        catch (Exception ex)
        {
            if (oConn.State == ConnectionState.Open)
            {
                Conexion.Cerrar(oConn);
            }
            sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex);
            return(sResul);
        }
        #endregion

        try
        {
            string[] aValores = Regex.Split(strDatos, "##");
            ///aValores[0] = IdTarea
            ///aValores[1] = nETE
            ///aValores[2] = sFFE
            ///aValores[3] = sObservaciones
            ///aValores[4] = nFinalizado;
            ///aValores[5] = nFinalizadoAntes;
            ///aValores[6] = nPT;
            ///aValores[7] = Desc Tarea;
            ///aValores[8] = sNotas;
            ///aValores[9] = txtNotas1;
            ///aValores[10] = txtNotas2;
            ///aValores[11] = txtNotas3;
            ///aValores[12] = txtNotas4;
            ///aValores[13] = sComentarioOriginal;
            ///aValores[14] = nETEOriginal;
            ///aValores[15] = sFFEOriginal;

            double   nETE = 0;
            DateTime?sFFE = null;

            if (aValores[1] != "")
            {
                nETE = double.Parse(aValores[1]);
            }
            if (aValores[2] != "")
            {
                sFFE = DateTime.Parse(aValores[2]);
            }

            TareaRecurso.ActualizarEstimacion(tr, int.Parse(Session["NUM_EMPLEADO_IAP"].ToString()), int.Parse(aValores[0]), sFFE, nETE, Utilidades.unescape(aValores[3]), (aValores[4] == "1")?true:false);

            if (aValores[5] == "0" && aValores[4] == "1")
            {
                //Si antes la tarea no estaba finalizada y ahora sí,
                //Mail al (a los) RTPT indicando que se ha finalizado
                //y continuar con la grabación
//                TareaFinalizada(tr, int.Parse(aValores[0]), int.Parse(aValores[6]));
            }

            if (aValores[3] != aValores[13] || aValores[1] != aValores[14] || aValores[2] != aValores[15])
            {
                //Si se han modificado los comentarios del técnico al gerente
                //Mail al (a los) RTPT
//                EstimacionModificada(tr, int.Parse(aValores[0]), int.Parse(aValores[6]));
            }

            if (aValores[8] == "1")
            {
                TAREAPSP.ActualizarNotas(tr, int.Parse(aValores[0]), Utilidades.unescape(aValores[9]), Utilidades.unescape(aValores[10]), Utilidades.unescape(aValores[11]), Utilidades.unescape(aValores[12]));
            }

            Conexion.CommitTransaccion(tr);
            sResul = "OK@#@";
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = "Error@#@" + Errores.mostrarError("Error al grabar los datos de la tarea", ex);
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }

        try
        {
            if (aListCorreo.Count > 0)
            {
                Correo.EnviarCorreos(aListCorreo);
            }
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al enviar el mail a los responsables técnicos de proyectos técnicos", ex);
        }

        return(sResul);
    }
    private string ObtenerTareas2(string sPE, string sPT, string sF, string sA)
    {
        StringBuilder sb = new StringBuilder();
        SqlDataReader dr;

        try
        {
            if (sPT == "")
            {
                dr = TAREAPSP.CatalogoPE(int.Parse(sPE), (int)Session["UsuarioActual"]);
            }
            else
            {
                if (sF == "")
                {
                    if (sA == "")
                    {
                        dr = TAREAPSP.CatalogoPT(int.Parse(sPT));
                    }
                    else
                    {
                        dr = TAREAPSP.CatalogoA(int.Parse(sA));
                    }
                }
                else
                {
                    if (sA == "")
                    {
                        dr = TAREAPSP.CatalogoF(int.Parse(sF));
                    }
                    else
                    {
                        dr = TAREAPSP.CatalogoA(int.Parse(sA));
                    }
                }
            }
            sb.Append("<div style='background-image:url(../../../../Images/imgFT16.gif); width: 460px;'>");
            sb.Append("<table id='tblOpciones2' class='texto MANO' style='width: 460px;' mantenimiento='0'>");
            sb.Append("<colgroup><col style='width:445px;' /><col style='width:15px'/></colgroup>");//style='padding-left:5px'
            sb.Append("<tbody>");
            while (dr.Read())
            {
                sb.Append("<tr id='" + dr["t332_idtarea"].ToString() + "' ");
                if ((bool)dr["t332_notif_prof"])
                {
                    sb.Append(" notif='S' ");
                }
                else
                {
                    sb.Append(" notif='N' ");
                }
                sb.Append("onClick='mm(event)' style='height:16px' style='noWrap:true;' title=\"cssbody=[dvbdy] cssheader=[dvhdr] ");
                sb.Append("header=[<img src='../../../../images/info.gif' style='vertical-align:middle' />  Información] body=[");
                sb.Append("<label style='width:60px'>P.T.&nbsp;:</label>" + dr["t331_despt"].ToString().Replace((char)34, (char)39));
                sb.Append("<br><label style='width:60px'>Fase&nbsp;:</label>" + dr["t334_desfase"].ToString().Replace((char)34, (char)39));
                sb.Append("<br><label style='width:60px'>Actividad&nbsp;:</label>" + dr["t335_desactividad"].ToString().Replace((char)34, (char)39));
                sb.Append("<br><label style='width:60px'>Tarea&nbsp;:</label>" + int.Parse(dr["t332_idtarea"].ToString()).ToString("#,###") + " " + dr["t332_destarea"].ToString().Replace((char)34, (char)39) + "] hideselects=[off]\">");
                sb.Append("<td style='padding-left:3px;'><nobr class='NBR W430'>" + dr["t332_destarea"].ToString() + "</nobr></td>");
                sb.Append("<td><input type='checkbox' style='width:15' class='checkTabla' checked='true'></td></tr>");
            }
            dr.Close();
            dr.Dispose();
            sb.Append("<tbody>");
            sb.Append("</table></div>");
            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener las tareas ", ex));
        }
    }
Ejemplo n.º 22
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 string Grabar(string strDatosTarea, string slTareas)
    {
        string sIdTarea, sEstado, sResul = "";
        int    nIdTarea, nIdPT, iUsuario;
        bool   bFaltanValoresAE = false, bPrimeraTarea = true;
        short  nOrden = 0, iCodUne;

        #region abrir conexión y transacción
        try
        {
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccion(oConn);
        }
        catch (Exception ex)
        {
            if (oConn.State == ConnectionState.Open)
            {
                Conexion.Cerrar(oConn);
            }
            sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex);
            return(sResul);
        }
        #endregion
        try
        {
            string[] aDatosTarea = Regex.Split(strDatosTarea, "##");
            ///aDatosTarea[0] = IDPT
            ///aDatosTarea[1] = ID Actividad
            ///aDatosTarea[2] = NodoActivo
            int?nAct = null;
            if ((aDatosTarea[1] != "") && (aDatosTarea[1] != "0"))
            {
                nAct = int.Parse(aDatosTarea[1]);
            }
            nIdPT    = int.Parse(aDatosTarea[0]);
            iUsuario = int.Parse(Session["NUM_EMPLEADO_ENTRADA"].ToString());
            iCodUne  = short.Parse(aDatosTarea[2]);

            string[] aTarea = Regex.Split(slTareas, "##");
            for (int i = 0; i < aTarea.Length; i++)
            {
                if (aTarea[i] != "")
                {
                    string[] aTar = Regex.Split(aTarea[i], ";");
                    sIdTarea = aTar[0];
                    sEstado  = aTar[1];
                    if ((sIdTarea != "") && (sIdTarea != "0"))
                    {
                        nIdTarea = int.Parse(sIdTarea);
                        if (bPrimeraTarea)
                        {
                            nOrden        = TAREAPSP.flCalcularOrden2(null, nIdPT);
                            bPrimeraTarea = false;
                        }
                        else
                        {
                            nOrden++;
                        }
                        TAREAPSP.ModificarPadre(tr, nIdTarea, nIdPT, nAct, nOrden, iUsuario);
                        //Como he podido cambiar de PT hay que ver si tiene los AE del nuevo PT para calcular su estado
                        //Siempre que la tarea no esté FINALIZADA, CERRADA o ANULADA (Victor 14/02/2012)
                        if (sEstado != "3" && sEstado != "4" && sEstado != "5")
                        {
                            bFaltanValoresAE = ProyTec.bFaltanValoresAE(tr, iCodUne, nIdPT);
                            if (bFaltanValoresAE)
                            {
                                TAREAPSP.ModificarEstado(tr, nIdTarea, 2, iUsuario);//Paso a estado PENDIENTE
                            }
                        }
                    }
                }
            }
            Conexion.CommitTransaccion(tr);

            sResul = "OK@#@";
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = "Error@#@" + Errores.mostrarError("Error al grabar los datos de la tarea", ex);
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }
        return(sResul);
    }
Ejemplo n.º 24
0
    private static string EnviarCorreoAlerta(string sIdAsunto, string strDatosTarea, string slIntegrantes, bool bAlta)
    {
        string        sResul = "", sTexto = "", sTO = "", sAux, sIdResponsable, slMails, sToAux = "";
        string        sAsunto = "", sAccionBD = "";
        bool          bNotificable = false;
        ArrayList     aListCorreo  = new ArrayList();
        StringBuilder sb           = new StringBuilder();

        try
        {
            string[] aDatosTarea = Regex.Split(strDatosTarea, "##");
            sIdResponsable = aDatosTarea[20];
            //slMails = Utilidades.unescape(aDatosTarea[7]);
            slMails = aDatosTarea[7];
            if (slMails == "" && sIdResponsable == "")
            {
                return("OK@#@");
            }
            sAsunto = "Alerta de asunto en Bitácora de tarea.";
            if (bAlta)
            {
                sb.Append("<BR>SUPER le informa de la generación del siguiente asunto:<BR><BR>");
            }
            else
            {
                sb.Append("<BR>SUPER le informa de la modificación del siguiente asunto:<BR><BR>");
            }
            // 0 -> id asunto (si -1 es un alta)
            // 1 -> descripcion corta
            // 2 -> descripcion larga
            // 3 -> referencia externa
            // 4 -> f/notificación
            // 5 -> f/fin
            // 6 -> f/limite
            // 7 -> alerta
            // 8 -> departamento
            // 9 -> tipo
            // 10-> estado
            // 11-> severidad
            // 12-> prioridad
            // 13-> sistema
            // 14-> esfuerzo planificado
            // 15-> esfuerzo real
            // 16 -> observaciones
            // 17 -> cod une
            // 18 -> cod Tarea
            // 19 -> notificador
            // 20 -> id responsable
            // 21 -> estado anterior
            // 22 -> nombre responsable
            // 23 -> desc tipo
            // 24-> desc estado
            // 25-> desc severidad
            // 26-> desc prioridad

            TAREAPSP oTar = TAREAPSP.Obtener(null, int.Parse(aDatosTarea[18]));

            sb.Append("<label style='width:120px'>Proyecto económico: </label>" + oTar.num_proyecto.ToString("#,###") + @" - " + oTar.nom_proyecto + "<br>");
            sb.Append("<label style='width:120px'>Proyecto técnico: </label>" + oTar.t331_despt + "<br>");
            sb.Append("<label style='width:120px'>Fase: </label>" + oTar.t334_desfase + "<br>");
            sb.Append("<label style='width:120px'>Actividad: </label>" + oTar.t335_desactividad + "<br>");
            sb.Append("<label style='width:120px'>Tarea: </label>" + int.Parse(aDatosTarea[18]).ToString("#,###") + @" - " + oTar.t332_destarea + "<br>");
            sb.Append("<label style='width:120px'>Asunto: </label><b>" + sIdAsunto + @" - " + Utilidades.unescape(aDatosTarea[1]) + "</b><br><br>");
            sb.Append("<b>Información del asunto:</b><br>");

            sb.Append("<label style='width:120px'>Responsable: </label>" + Utilidades.unescape(aDatosTarea[22]) + "<br>");
            sAux = aDatosTarea[6];
            if (sAux == "")
            {
                sb.Append("<label style='width:120px'>F/Límite: </label>&nbsp;<br>");
            }
            else
            {
                sb.Append("<label style='width:120px'>F/Límite: </label>" + sAux.Substring(0, 10) + "<br>");
            }
            sAux = aDatosTarea[5];
            if (sAux == "")
            {
                sb.Append("<label style='width:120px'>F/Fin: </label>&nbsp;<br>");
            }
            else
            {
                sb.Append("<label style='width:120px'>F/Fin: </label>" + sAux.Substring(0, 10) + "<br>");
            }
            sb.Append("<label style='width:120px'>Ref. Externa: </label>" + Utilidades.unescape(aDatosTarea[3]) + "<br>");
            sb.Append("<label style='width:120px'>Esfuerzo planificado: </label>" + Utilidades.unescape(aDatosTarea[14]) + "<br>");
            sb.Append("<label style='width:120px'>Esfuerzo real: </label>" + Utilidades.unescape(aDatosTarea[15]) + "<br>");
            sb.Append("<label style='width:120px'>Severidad: </label>" + Utilidades.unescape(aDatosTarea[25]) + "<br>");
            sb.Append("<label style='width:120px'>Prioridad: </label>" + Utilidades.unescape(aDatosTarea[26]) + "<br>");
            sb.Append("<label style='width:120px'>Tipo: </label>" + Utilidades.unescape(aDatosTarea[23]) + "<br>");
            sb.Append("<label style='width:120px'>Estado: </label>" + Utilidades.unescape(aDatosTarea[24]) + "<br>");
            sb.Append("<label style='width:120px'>Sistema afectado: </label>" + Utilidades.unescape(aDatosTarea[13]) + "<br><br>");
            //descripcion larga
            sb.Append("<b><label style='width:120px'>Descripción: </label></b>" + Utilidades.unescape(aDatosTarea[2]) + "<br><br>");
            //observaciones
            sb.Append("<b><label style='width:120px'>Observaciones: </label></b>" + Utilidades.unescape(aDatosTarea[16]) + "<br><br>");
            //Departamento
            sb.Append("<b><label style='width:120px'>Departamento: </label></b>" + Utilidades.unescape(aDatosTarea[8]) + "<br><br>");

            //Obtengo la lista de e-mail a los que alertar
            if (!slMails.Contains(";"))
            {
                slMails += ";";
            }
            string[] aMails = Regex.Split(slMails, ";");
            //Genero una tabla con la lista de e-mails a notificar
            sb.Append("<b><label style='width:400px'>Relación de e-mails a notificar: </label></b>&nbsp;<br>");
            sb.Append("<table width='400px' style='padding:10px;'>");
            sb.Append("<colgroup><col style='width:400px;' /></colgroup>");
            sb.Append("<tbody>");
            for (int i = 0; i < aMails.Length; i++)
            {
                sToAux = aMails[i].Trim();
                if (sToAux != "")
                {
                    sb.Append("<tr><td style='padding-left:5px;font-size:11px;'>");
                    sTO  = Utilidades.unescape(aMails[i]);
                    sAux = sTO.Substring(0, 2);
                    if (sAux == "\r\n")
                    {
                        sTO = sTO.Substring(2);
                    }
                    sb.Append(sTO);
                    sb.Append("</td></tr>");
                }
            }
            sb.Append("</tbody>");
            sb.Append("</table><br>");
            //Genero una tabla con la lista de profesionales a notificar
            sb.Append("<b><label style='width:400px'>Relación de profesionales asignados: </label>&nbsp;</b><br>");
            sb.Append("<table width='400px' style='padding:10px;'>");
            sb.Append("<colgroup><col style='width:400px;' /></colgroup>");
            sb.Append("<tbody>");
            if (slIntegrantes != "")
            {//Con la cadena generamos una lista y la recorremos
                string[] aPersonas = Regex.Split(slIntegrantes, @"///");

                for (int i = 0; i < aPersonas.Length; i++)
                {
                    if (aPersonas[i] != "")
                    {
                        string[] aIntegrante = Regex.Split(aPersonas[i], @"##");
                        sAccionBD = aIntegrante[0];
                        if (aIntegrante[2] == "1")
                        {
                            bNotificable = true;
                        }
                        else
                        {
                            bNotificable = false;
                        }
                        switch (sAccionBD)
                        {
                        case "":
                        case "I":
                        case "U":
                        case "N":
                            sb.Append("<tr><td style='padding-left:5px;font-size:11px;'>");
                            sb.Append(Utilidades.unescape(aIntegrante[3]));
                            sb.Append("</td></tr>");
                            break;
                        }
                    }
                }//for
            }
            sb.Append("</tbody>");
            sb.Append("</table><br>");

            sTexto = sb.ToString();

            //Envío e-mail al responsable del asunto
            if (sIdResponsable != "")
            {
                //sTO = Recurso.CodigoRed(int.Parse(sIdResponsable));
                sTO = SUPER.Capa_Negocio.Recurso.GetDireccionMail(int.Parse(sIdResponsable));
                string[] aMail = { sAsunto, sTexto, sTO };
                aListCorreo.Add(aMail);
            }
            //Obtengo la lista de e-mail a los que alertar y envío un correo a cada uno
            for (int i = 0; i < aMails.Length; i++)
            {
                if (aMails[i] != "")
                {
                    sTO = aMails[i];
                    //sTO.Replace((char)10, (char)160);
                    //sTO.Replace((char)13, (char)160);
                    sAux = sTO.Substring(0, 2);
                    if (sAux == "\r\n")
                    {
                        sTO = sTO.Substring(2);
                    }
                    sTO.Trim();
                    string[] aMail = { sAsunto, sTexto, sTO };
                    aListCorreo.Add(aMail);
                }
            }
            //Obtengo la lista de profesionales a los que notificar y envío un correo a cada uno
            if (slIntegrantes == "")
            {//Tenemos lista vacía. No hacemos nada
            }
            else
            {//Con la cadena generamos una lista y la recorremos
                string[] aPersonas = Regex.Split(slIntegrantes, @"///");

                for (int i = 0; i < aPersonas.Length; i++)
                {
                    if (aPersonas[i] != "")
                    {
                        string[] aIntegrante = Regex.Split(aPersonas[i], @"##");
                        sAccionBD = aIntegrante[0];
                        sTO       = aIntegrante[4];
                        if (aIntegrante[2] == "1")
                        {
                            bNotificable = true;
                        }
                        else
                        {
                            bNotificable = false;
                        }
                        if (bNotificable)
                        {
                            switch (sAccionBD)
                            {
                            case "":
                            case "I":
                            case "U":
                            case "N":
                                string[] aMail = { sAsunto, sTexto, sTO };
                                aListCorreo.Add(aMail);
                                break;
                            }
                        }
                    }
                }//for
            }

            Correo.EnviarCorreos(aListCorreo);

            sResul = "OK@#@";
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al enviar correo de asunto de Bitácora de tarea. Asunto=" + sIdAsunto, ex);
        }
        return(sResul);
    }
    private static string EnviarCorreoAlerta(string sTipo, string strDatosTarea, string slMails, string slIntegrantes, string sIdResponsable, bool bAlta)
    {
        string sResul = "", sTexto = "", sTO = "", sAux, sToAux = "", sIdAccion = "";
        string sAsunto = "", sAccionBD="";
        bool bNotificable;
        ArrayList aListCorreo = new ArrayList();
        StringBuilder sb = new StringBuilder();

        try
        {
            if (slMails == "" && slIntegrantes == "" && sIdResponsable=="") return "OK@#@";
            sAsunto = "Alerta de acción en Bitácora de tarea.";
            if (bAlta) sb.Append("<BR>SUPER le informa de la generación de la siguiente acción:<BR><BR>");
            else sb.Append("<BR>SUPER le informa de la modificación de la siguiente acción:<BR><BR>");
            string[] aDatosTarea = Regex.Split(strDatosTarea, "##");
            //aDatosTarea[0] = hdnIdAccion
            //aDatosTarea[1] = txtDesAccion
            //aDatosTarea[2] = cod asunto
            //aDatosTarea[3] = des asunto
            //aDatosTarea[4] = f/limite
            //aDatosTarea[5] = f/fin
            //aDatosTarea[6] = avance
            //aDatosTarea[7] = descripción larga acción
            //aDatosTarea[8] = observaciones
            //aDatosTarea[9] = Dpto
            //aDatosTarea[10] = idTarea

            TAREAPSP oTar = TAREAPSP.Obtener(null, int.Parse(aDatosTarea[10]));
            sIdAccion = aDatosTarea[0];
            sb.Append("<label style='width:120px'>Proyecto económico: </label>" + oTar.num_proyecto.ToString("#,###") + @" - " + oTar.nom_proyecto + "<br>");
            sb.Append("<label style='width:120px'>Proyecto técnico: </label>" + oTar.t331_despt + "<br>");
            sb.Append("<label style='width:120px'>Fase: </label>" + oTar.t334_desfase + "<br>");
            sb.Append("<label style='width:120px'>Actividad: </label>" + oTar.t335_desactividad + "<br>");
            sb.Append("<label style='width:120px'>Tarea: </label>" + int.Parse(aDatosTarea[10]).ToString("#,###") + @" - " + oTar.t332_destarea + "<br>");
            //sb.Append("<label style='width:120px'>Asunto: </label>" + aDatosTarea[2] + @" - " + Utilidades.unescape(aDatosTarea[3]) + "<br>");
            //sb.Append("<label style='width:120px'>Acción: </label><b>" + aDatosTarea[0] + @" - " + Utilidades.unescape(aDatosTarea[1]) + "</b><br><br>");
            sb.Append("<label style='width:120px'>Asunto: </label>" + aDatosTarea[2] + @" - " + aDatosTarea[3] + "<br>");
            sb.Append("<label style='width:120px'>Acción: </label><b>" + aDatosTarea[0] + @" - " + aDatosTarea[1] + "</b><br><br>");
            sb.Append("<b>Información de la acción:</b><br>");

            sAux = aDatosTarea[4];
            if (sAux == "")
                sb.Append("<label style='width:120px'>F/Límite: </label>&nbsp;<br>");
            else
                sb.Append("<label style='width:120px'>F/Límite: </label>" + sAux.Substring(0, 10) + "<br>");
            sAux = aDatosTarea[5];
            if (sAux == "")
                sb.Append("<label style='width:120px'>F/Fin: </label>&nbsp;");
            else
                sb.Append("<label style='width:120px'>F/Fin: </label>" + sAux.Substring(0, 10));
            //avance
            sAux = aDatosTarea[6];
            sb.Append("<br><label style='width:120px'>Avance: </label>" + sAux + "<br><br>");
            //descripcion larga
            //sAux = Utilidades.unescape(aDatosTarea[7]);
            sb.Append("<b><label style='width:120px'>Descripción: </label></b>" + aDatosTarea[7] + "<br><br>");
            //observaciones
            //sAux = Utilidades.unescape(aDatosTarea[8]);
            sb.Append("<b><label style='width:120px'>Observaciones: </label></b><br>" + aDatosTarea[8]);
            //Departamento/Grupo
            //sAux = Utilidades.unescape(aDatosTarea[9]);
            sb.Append("<br><br><b><label style='width:120px'>Departamento/Grupo: </label></b>" + aDatosTarea[9]);

            sb.Append("<br><br>");
            //Obtengo la lista de e-mail a los que alertar
            if (!slMails.Contains(";")) slMails += ";";
            string[] aMails = Regex.Split(slMails, ";");
            //Genero una tabla con la lista de e-mails a notificar
            sb.Append("<b><label style='width:400px'>Relación de e-mails a notificar: </label></b>&nbsp;<br>");
            sb.Append("<table width='400px' style='padding:10px;'>");
            sb.Append("<colgroup><col style='width:400px;' /></colgroup>");
            sb.Append("<tbody>");
            for (int i = 0; i < aMails.Length; i++)
            {
                sToAux = aMails[i].Trim();
                if (sToAux != "")
                {
                    sb.Append("<tr><td style='padding-left:5px;font-size:11px;'>");
                    //sTO = Utilidades.unescape(aMails[i]);
                    sTO = sToAux;
                    sAux = sTO.Substring(0, 2);
                    if (sAux == "\r\n") sTO = sTO.Substring(2);
                    sb.Append(sTO);
                    sb.Append("</td></tr>");
                }
            }
            sb.Append("</tbody>");
            sb.Append("</table><br>");
            //Genero una tabla con la lista de profesionales a notificar
            sb.Append("<b><label style='width:400px'>Relación de profesionales asignados: </label>&nbsp;</b><br>");
            sb.Append("<table width='400px' style='padding:10px;'>");
            sb.Append("<colgroup><col style='width:400px;' /></colgroup>");
            sb.Append("<tbody>");
            if (slIntegrantes != "")
            {//Con la cadena generamos una lista y la recorremos 
                string[] aPersonas = Regex.Split(slIntegrantes, @"///");

                for (int i = 0; i < aPersonas.Length; i++)
                {
                    if (aPersonas[i] != "")
                    {
                        string[] aIntegrante = Regex.Split(aPersonas[i], @"##");
                        sAccionBD = aIntegrante[0];
                        if (aIntegrante[2] == "1") bNotificable = true;
                        else bNotificable = false;
                        switch (sAccionBD)
                        {
                            case "":
                            case "I":
                            case "U":
                            case "N":
                                sb.Append("<tr><td style='padding-left:5px;font-size:11px;'>");
                                sb.Append(Utilidades.unescape(aIntegrante[3]));
                                sb.Append("</td></tr>");
                                break;
                        }
                    }
                }//for
            }
            sb.Append("</tbody>");
            sb.Append("</table><br>");
            
            sTexto = sb.ToString();

            //Envío e-mail al responsable del asunto 
            if (sIdResponsable != "")
            {
                //sTO = Recurso.CodigoRed(int.Parse(sIdResponsable));
                sTO = SUPER.Capa_Negocio.Recurso.GetDireccionMail(int.Parse(sIdResponsable));
                string[] aMail = { sAsunto, sTexto, sTO };
                aListCorreo.Add(aMail);
            }
            //Obtengo la lista de e-mail a los que alertar y envío un correo a cada uno
            for (int i = 0; i < aMails.Length; i++)
            {
                if (aMails[i] != "")
                {
                    sTO = aMails[i];
                    //sTO = Utilidades.unescape(aMails[i]);
                    sAux = sTO.Substring(0, 2);
                    if (sAux == "\r\n") sTO = sTO.Substring(2);
                    sTO.Trim();
                    string[] aMail = { sAsunto, sTexto, sTO };
                    aListCorreo.Add(aMail);
                }
            }
            //Obtengo la lista de profesionales a los que notificar y envío un correo a cada uno
            if (slIntegrantes == "")
            {//Tenemos lista vacía. No hacemos nada
            }
            else
            {//Con la cadena generamos una lista y la recorremos 
                string[] aPersonas = Regex.Split(slIntegrantes, @"///");
                
                for (int i = 0; i < aPersonas.Length; i++)
                {
                    if (aPersonas[i] != "")
                    {
                        string[] aIntegrante = Regex.Split(aPersonas[i], @"##");
                        sAccionBD = aIntegrante[0];
                        sTO = aIntegrante[4];
                        if (aIntegrante[2] == "1") bNotificable = true;
                        else bNotificable = false;
                        if (bNotificable)
                        {
                            switch (sAccionBD)
                            {
                                case "":
                                case "I":
                                case "U":
                                case "N":
                                    string[] aMail = { sAsunto, sTexto, sTO };
                                    aListCorreo.Add(aMail);
                                    break;
                            }
                        }
                    }
                }//for
            }

            Correo.EnviarCorreos(aListCorreo);
            sResul = "OK@#@";
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al enviar correo de acción de Bitácora de Tarea (sIdResponsable=" + sIdResponsable + " sIdAccion=" + sIdAccion + ").", ex);
        }
        return sResul;
    }