Ejemplo n.º 1
0
        private void btn_enviar_Click(object sender, EventArgs e)
        {
            if (Publicacion.Text != "")
            {
                if (!file)
                {

                    DataSourcePOI dsp = new DataSourcePOI();

                    DataTable dtt = dsp.insertPublicacion(Publicacion.Text, idGrupo, id);

                    if (dtt.Rows[0][0].ToString() != "null")
                    {
                        DataTable dt = dsp.getPublicacion(idGrupo);

                        for (int bc = 0; bc < dt.Rows.Count; bc++)
                        {

                            c_desplegar c = new c_desplegar(dt.Rows[bc][4] + "", dt.Rows[bc][1] + "", int.Parse(dtt.Rows[0][0].ToString()), idGrupo, id, file, dt.Rows[bc][5].ToString(), socketPublicacion);

                        }
                        Publicacion.Text = "";
                        flp.Controls.Clear();
                        FG fg = new FG();
                        fg.publicaciones(id, idGrupo, socketPublicacion, flp);
                    }
                }
                else
                {
                    Mensaje mensaje = new Mensaje();
                    mensaje.archi = a;
                    mensaje.tipoo = Mensaje.tipo.publicacionarchivo;

                    DataSourcePOI dsp = new DataSourcePOI();

                    DataTable dtt = dsp.insertPublicacionArchivo(Publicacion.Text, idGrupo, id, a.j);

                    if (dtt.Rows[0][0].ToString() != "null")
                    {
                        DataTable dt = dsp.getPublicacion(idGrupo);

                        for (int bc = 0; bc < dt.Rows.Count; bc++)
                        {
                            c_desplegar c = new c_desplegar(dt.Rows[bc][4] + "", dt.Rows[bc][1] + "", int.Parse(dtt.Rows[0][0].ToString()), idGrupo, id, file, dt.Rows[bc][5].ToString(), socketPublicacion);

                        }
                        Publicacion.Text = "";
                        flp.Controls.Clear();
                        FG fg = new FG();
                        fg.publicaciones(id, idGrupo, socketPublicacion, flp);
                    }
                    socketPublicacion.Send(mensaje.toBytes());
                    file = false;
                }
            }
        }
Ejemplo n.º 2
0
        public void publicaciones(int id, int idGrupo, Socket conectado, FlowLayoutPanel flp_publicacion)
        {
            DataSourcePOI dsp = new DataSourcePOI();

            c_Publicacion p = new c_Publicacion(id, idGrupo, conectado, flp_publicacion);
            flp_publicacion.Controls.Add(p);

            DataTable dt = dsp.getPublicacion(idGrupo);
            c_desplegar c = null;

            tareas(id, idGrupo, conectado, flowLayoutPanel2);

            subrgupos(id, idGrupo, conectado, flowLayoutPanel1);

            bool isExistsFile = false;

            int temp = 0;

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    // c_desplegar c = new c_desplegar("nombre"+i, "Toda la publicacion aqui", 1);

                    string comprar = dt.Rows[i][5].ToString();

                    if (!"".Equals(comprar))
                    {
                        isExistsFile = true;
                    }

                    c = new c_desplegar(dt.Rows[i][4] + "", dt.Rows[i][1] + "", int.Parse(dt.Rows[i][0].ToString()), idGrupo, id, isExistsFile, dt.Rows[i][5].ToString(), conectado);

                    DataTable dtc = dsp.getComentario(int.Parse(dt.Rows[i][0].ToString()));

                    temp = int.Parse(dt.Rows[i][0].ToString());

                    if (dtc != null)
                    {
                        for (int j = 0; j < dtc.Rows.Count; j++)
                        {
                            int temp2 = int.Parse(dtc.Rows[j][1].ToString());
                            if (temp == temp2)
                            {
                                Label l = new Label();
                                l.Text = dtc.Rows[j][0].ToString();
                                c.flp_comentarios.Controls.Add(l);
                            }
                        }
                    }
                    flp_publicacion.Controls.Add(c);
                    isExistsFile = false;
                }
            }
        }