コード例 #1
0
        public void cargar_foros_academicos()
        {
            Foro[] foros = new Foro().cargar_por_tipo("1");
            for (int i = 0; i < foros.Length;i++ )
            {
                TableRow fila1 = new TableRow();
                fila1.Height = 30;
                TableCell celda = new TableCell();
                celda.CssClass = "td";
                celda.Text = foros[i].Tema;
                TableCell celda1 = new TableCell();
                celda1.CssClass = "td";
                celda1.Text = foros[i].Pregunta;
                TableCell celda2 = new TableCell();
                celda2.CssClass = "td";
                celda2.Text = Convert.ToDateTime(foros[i].Fecha).ToString("dd-MM-yyyy");
                TableCell celda3 = new TableCell();
                celda3.CssClass = "td";
                HyperLink link_usu = new HyperLink();
                link_usu.Text= foros[i].Usuario;
                celda3.Controls.AddAt(0, link_usu);
                TableCell celda4 = new TableCell();
                celda4.CssClass = "td";
                HyperLink link = new HyperLink();
                link.NavigateUrl = Global.ruta + "/mostrar_foro.aspx?id=" + foros[i].Id;
                link.Text = "Ir al foro";
                celda4.Controls.AddAt(0, link);

                fila1.Cells.Add(celda);
                fila1.Cells.Add(celda1);
                fila1.Cells.Add(celda2);
                fila1.Cells.Add(celda3);
                fila1.Cells.Add(celda4);

                TableCell celda5 = new TableCell();
                celda5.CssClass = "td";
                TableCell celda6 = new TableCell();
                celda6.CssClass = "td";

                if(foros[i].Cod_usuario.Equals(cod)){
                    ImageButton edit = new ImageButton();
                    edit.ImageUrl = "~/Imagenes/edit.png";
                    edit.CommandName = foros[i].Id;
                    edit.PostBackUrl="~/Paginas/editar_foro.aspx?tipo=1&fo="+foros[i].Id+"";
                    celda5.Controls.AddAt(0, edit);
                    HyperLink link_eli = new HyperLink();
                    link_eli.Text = "<a href=\"ejemplo.htm\" target=\"_blank\" onClick=\"window.open('/Paginas/mensaje_eliminar.aspx?id=" + foros[i].Id + "&op=1', this.target, 'width=250,height=50,left=540,top=200,scrollbars=NO, resizable=NO'); return false;\"><img src=\"/Imagenes/eliminar_btn.png\"></a>";
                    celda6.Controls.AddAt(0, link_eli);
                }
                fila1.Cells.Add(celda5);
                fila1.Cells.Add(celda6);
                Table1.Rows.Add(fila1);
            }
        }
コード例 #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Foro foroe = new Foro();
            foroe.Cod_usuario = Convert.ToString(Session["cod"]);
            foroe.Tipo_foro = cod_tipo;
            foroe.Tema = DropDownList2.SelectedValue;
            if (!String.IsNullOrWhiteSpace(TextBox1.Text))
            {
                foroe.Pregunta = TextBox1.Text;
                foroe.crear();
                if (foroe.Tipo_foro.Equals("1"))
                {
                    Response.Redirect(Global.ruta + "/foros_academico.aspx");
                }
                else
                {
                    Response.Redirect(Global.ruta + "/foros_investigacion.aspx");
                }

            }
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     cod_tipo = Request.QueryString["tipo"];
     cod_foro = Request.QueryString["fo"];
     if (cod_tipo.Equals("1"))
     {
         Label7.Text = "Foro Academico";
     }
     else
     {
         Label7.Text = "Foro Investigativo";
     }
     if (!IsPostBack)
     {
         foro = new Foro();
         foro.cargar(cod_foro);
         DropDownList2.DataSource = ListasDesple.getTema();
         DropDownList2.DataTextField = "nombre";
         DropDownList2.DataValueField = "id_tema";
         DropDownList2.DataBind();
         TextBox1.Text = foro.Pregunta;
         DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf(DropDownList2.Items.FindByText(foro.Tema));
     }
 }
コード例 #4
0
        public void cargar_noti_foro()
        {
            Foro[] foros = new Foro().cargar_noti_foro(Convert.ToString(Session["r_muro"]));
            if (foros != null)
            {
                for (int i = 0; i < foros.Length; i++)
                {
                    TableRow fila_nombre_foro = new TableRow();
                    TableCell celda1 = new TableCell();
                    HyperLink link = new HyperLink();
                    link.Text = foros[i].Usuario;
                    link.NavigateUrl = Global.ruta + "/perfil.aspx?cod=" + foros[i].Cod_usuario;
                    celda1.Controls.AddAt(0, link);
                    fila_nombre_foro.Cells.Add(celda1);
                    celda1.Attributes.Add("style", "BORDER-TOP:solid 2px blue");

                    TableRow espacio = new TableRow();
                    TableCell celda7 = new TableCell();
                    celda7.Text = "<br />";
                    espacio.Cells.Add(celda7);

                    TableRow ofertat = new TableRow();
                    TableRow oficio_oferta = new TableRow();
                    TableRow fecha_oferta = new TableRow();
                    TableRow fecha_limite = new TableRow();
                    TableRow ir_oferta = new TableRow();

                    TableCell celda2 = new TableCell();
                    celda2.Text = "Foro : " + foros[i].Tipo_foro;

                    TableCell celda3 = new TableCell();
                    celda3.Text = "Tema : " + foros[i].Tema;

                    TableCell celda4 = new TableCell();
                    celda4.Text = "Pregunta : " + foros[i].Pregunta;

                    TableCell celda6 = new TableCell();
                    celda6.Text = "Foro creada el : " + Convert.ToDateTime(foros[i].Fecha).ToString("dd-MM-yyyy");

                    TableCell celda5 = new TableCell();
                    HyperLink link_ir = new HyperLink();
                    link_ir.Text = "Ir al foro";
                    link_ir.NavigateUrl = Global.ruta + "/mostrar_foro.aspx?id=" + foros[i].Id;
                    celda5.Controls.AddAt(0, link_ir);

                    ofertat.Cells.Add(celda2);
                    oficio_oferta.Cells.Add(celda3);
                    fecha_limite.Cells.Add(celda6);
                    fecha_oferta.Cells.Add(celda4);
                    ir_oferta.Cells.Add(celda5);

                    Table2.Rows.Add(espacio);
                    Table2.Rows.Add(fila_nombre_foro);
                    Table2.Rows.Add(ofertat);
                    Table2.Rows.Add(oficio_oferta);
                    Table2.Rows.Add(fecha_oferta);
                    Table2.Rows.Add(fecha_limite);
                    Table2.Rows.Add(ir_oferta);
                }
            }
        }
コード例 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id_foro =  Request.QueryString["id"];
     Foro foro = new Foro();
     foro.cargar(id_foro);
     Label1.Text = foro.Tipo_foro;
     Label2.Text = foro.Tema;
     Label3.Text ="¿ "+ foro.Pregunta+" ?";
     HyperLink1.Text = " "+foro.Usuario;
     HyperLink1.NavigateUrl = Global.ruta + "/perfil.aspx?cod=" + foro.Cod_usuario;
     Label5.Text = "Creado el : "+Convert.ToDateTime(foro.Fecha).ToString("dd-MM-yyyy");
     if(!IsPostBack){
         Session["r_foro"] = "10";
     }
     cargar_comentarios();
 }
コード例 #6
0
ファイル: Foro.cs プロジェクト: MavcDev/Observatorio-Laboral
 public Foro[] cargar_noti_foro(String limite)
 {
     Foro[] foros;
     ConexionMySql cone = new ConexionMySql();
     if (cone.conexion(false, "cadconex"))
     {
         DataSet data = cone.consulta("select foro.id_foro,foro.pregunta,foro.fecha, Concat(usu.nombre1,' ',usu.apellido1),tema.nombre,tipof.nombre,cod from foro  inner join  usuario as usu on usu.cod=fk_usu1 inner join tema on tema.id_tema=fk_tema inner join tipo_foro as tipof on tipof.id_tipo_foro=fk_tipo_foro order by fecha desc limit " + limite + ";");
         if (data != null)
         {
             foros = new Foro[data.Tables[0].Rows.Count];
             for (int i = 0; i < foros.Length; i++)
             {
                 foros[i] = new Foro();
                 foros[i].Id = Convert.ToString(data.Tables[0].Rows[i][0]); foros[i].Pregunta = Convert.ToString(data.Tables[0].Rows[i][1]);
                 foros[i].Fecha = Convert.ToString(data.Tables[0].Rows[i][2]);
                 foros[i].Usuario = Convert.ToString(data.Tables[0].Rows[i][3]);
                 foros[i].Tipo_foro = Convert.ToString(data.Tables[0].Rows[i][5]);
                 foros[i].Tema = Convert.ToString(data.Tables[0].Rows[i][4]);
                 foros[i].Cod_usuario = Convert.ToString(data.Tables[0].Rows[i][6]);
             }
             cone.desconectar();
             return foros;
         }
     }
     cone.desconectar();
     return null;
 }
コード例 #7
0
ファイル: Foro.cs プロジェクト: MavcDev/Observatorio-Laboral
 public Foro[] cargar_por_tema_tipo(String id_te,String id_tipo)
 {
     Foro[] foros_tema;
     ConexionMySql cone = new ConexionMySql();
     if (cone.conexion(false, "cadconex"))
     {
         DataSet data = cone.consulta("select id_foro,pregunta from foro inner join tema on tema.id_tema=fk_tema where tema.id_tema="+id_te+" and  fk_tipo_foro="+id_tipo+";");
         if (data != null)
         {
             foros_tema = new Foro[data.Tables[0].Rows.Count];
             for (int i = 0; i < foros_tema.Length;i++ )
             {
                 foros_tema[i] = new Foro();
                 foros_tema[i].Id = Convert.ToString(data.Tables[0].Rows[i][0]);
                 foros_tema[i].Pregunta = Convert.ToString(data.Tables[0].Rows[i][1]);
             }
             cone.desconectar();
             return foros_tema;
         }
     }
     cone.desconectar();
     return null;
 }