Exemplo n.º 1
0
        private void generarDocumentoHTML(Nodo n, DateTime now, string fname, string docPath, string URL)
        {
            List <Nodo> pathn  = getPath(n.id);
            Modelo      m      = grupo.organizacion.getModeloDocumento(n.modeloID);
            DateTime    inicio = DateTime.MaxValue;

            //junto propuestas
            List <Propuesta> props = new List <Propuesta>();

            foreach (Nodo n1 in pathn)
            {
                Propuesta p = getPropuesta(n1);
                if (p != null) //la raiz
                {
                    props.Add(p);
                    if (p.born < inicio)
                    {
                        inicio = p.born;
                    }
                }
            }
            //firma consenso
            string ret = "";

            ret += "Documento escrito de forma cooperativa.<br>";
            ret += "Grupo: " + this.nombre + "<br>";
            ret += "Documento ID:" + fname + "<br>";
            ret += "Inicio de debate: " + inicio.ToString("dd/MM/yy") + "<br>";
            ret += "Fecha de consenso: " + DateTime.Now.ToString("dd/MM/yy") + " " + DateTime.Now.ToShortTimeString() + "<br>";
            ret += "Ubicaci&oacute;n: <a target='_blank' href='" + URL + "'>" + URL + "</a><br>";
            ret += "Objetivo: " + this.grupo.objetivo + "<br>";
            ret += "Usuarios: " + this.grupo.getUsuariosHabilitados().Count + "<br>";
            ret += "Activos: " + this.grupo.activos + "<br>";
            ret += "Si: (&ge; " + this.minSiPc + "%): " + n.flores + "<br>";
            ret += "No: (&le; " + this.maxNoPc + "%): " + n.negados + "<br>";

            //admin
            if (this.grupo.getAdmin() != null)
            {
                ret += "Coordinador: " + grupo.getAdmin().nombre + "<br>";
            }

            //representates
            ret += "Representantes: ";
            foreach (Usuario rep in this.grupo.getRepresentantes())
            {
                ret += rep.nombre + ",";
            }
            if (ret.EndsWith(","))
            {
                ret = ret.Substring(0, ret.Length - 1);
            }
            ret += "<br>";

            //secretaria
            if (this.grupo.getSecretaria() != null)
            {
                ret += "Secretaria: " + grupo.getSecretaria().nombre + "<br>";
            }

            //facilitador
            if (this.grupo.getFacilitador() != null)
            {
                ret += "Facilitador: " + grupo.getFacilitador().nombre + "<br>";
            }

            //armo HTML
            string html = "";

            try
            {
                m.firmaConsenso = ret;
                html            = m.toHTML(props, this.grupo, "", 1024, Modelo.eModo.consenso);
            }
            catch (Exception ex)
            {
                throw new Exception("generarDocumentoHTML():toHTML():" + m.nombre + ":" + ex.Message + " " + ex.StackTrace);
            }

            //escribo
            System.IO.File.WriteAllText(grupo.path + "\\" + docPath + "\\" + fname + ".html", html, System.Text.Encoding.UTF8);
        }