protected void Page_Load(object sender, EventArgs e)
        {
            id_oferta = Request.QueryString["id"];
            oferta = new Oferta();
            oferta.cargar(id_oferta);
            Label1.Text = oferta.Oficio;
            Label2.Text = oferta.Pre_requisito;
            Label3.Text = oferta.Entidad;
            Label4.Text = oferta.Direccion;
            Label5.Text = oferta.Telefono_cel;
            Label6.Text = oferta.Telefono_cel_opcional;
            Label7.Text = oferta.Telefono_fijo;
            Label8.Text = oferta.Correo;
            Label9.Text = oferta.Correo_opcional;
            Label10.Text = oferta.Informacion_adicional;
            Label11.Text = Convert.ToDateTime(oferta.Fecha_limite).ToString("dd-MM-yyyy");
            Label12.Text = Convert.ToDateTime(oferta.Fecha).ToString("dd-MM-yyyy");

            if (oferta.Tipo.Equals("1"))
            {
                Label13.Text = "Oferta Academica";
            }
            else
            {
                Label13.Text = "Oferta Empleo";
            }
        }
        public void cargar_noti_oferta()
        {
            Oferta[] ofertas = new Oferta().cargar_notificacion(Convert.ToString(Session["r_muro"]));
            if(ofertas !=null){
                for (int i = 0; i < ofertas.Length;i++ )
                {
                    TableRow fila_nombre_foro = new TableRow();
                    TableCell celda1 = new TableCell();
                    HyperLink link = new HyperLink();
                    link.Text = ofertas[i].Usuario;
                    link.NavigateUrl = Global.ruta + "/perfil.aspx?cod=" + ofertas[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 = "Oferta : " + ofertas[i].Tipo;

                    TableCell celda3 = new TableCell();
                    celda3.Text = "Oficio : " + ofertas[i].Oficio;

                    TableCell celda4 = new TableCell();
                    celda4.Text = "Oferta Limte hasta el : " + Convert.ToDateTime(ofertas[i].Fecha_limite).ToString("dd-MM-yyyy");

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

                    TableCell celda5 = new TableCell();
                    HyperLink link_ir = new HyperLink();
                    link_ir.Text = "Ir a la oferta";
                    celda5.Controls.AddAt(0, link_ir);
                    link_ir.NavigateUrl = Global.ruta + "/mostrar_oferta.aspx?id=" + ofertas[i].Id;

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

                    Table1.Rows.Add(espacio);
                    Table1.Rows.Add(fila_nombre_foro);
                    Table1.Rows.Add(ofertat);
                    Table1.Rows.Add(oficio_oferta);
                    Table1.Rows.Add(fecha_limite);
                    Table1.Rows.Add(fecha_oferta);
                    Table1.Rows.Add(ir_oferta);
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     cod_tipo = Request.QueryString["tipo"];
     cod = Convert.ToString(Session["cod"]);
     cod_ofe = Request.QueryString["ofe"];
     oferta = new Oferta();
     oferta.cargar(cod_ofe);
     if (cod_tipo.Equals("1"))
     {
         Label1.Text = "Oferta Academica";
     }
     else
     {
         Label1.Text = "Oferta Empleo";
     }
     if(!IsPostBack){
         TextBox1.Text = oferta.Oficio;
         TextBox2.Text = oferta.Pre_requisito;
         TextBox3.Text = oferta.Entidad;
         TextBox4.Text = oferta.Direccion;
         TextBox5.Text = oferta.Telefono_cel;
         TextBox6.Text = oferta.Telefono_cel_opcional;
         TextBox7.Text = oferta.Telefono_fijo;
         TextBox8.Text = oferta.Correo;
         TextBox9.Text = oferta.Correo_opcional;
         TextBox10.Text = oferta.Informacion_adicional;
         TextBox11.Text = Convert.ToDateTime(oferta.Fecha_limite).ToString("yyyy-MM-dd");
     }
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     Oferta oferta = new Oferta();
     oferta.Id = cod_ofe;
     oferta.Cod_usuario = cod;
     oferta.Tipo = cod_tipo;
     oferta.Oficio = TextBox1.Text;
     oferta.Pre_requisito = TextBox2.Text;
     oferta.Entidad = TextBox3.Text;
     oferta.Direccion = TextBox4.Text;
     oferta.Telefono_cel = TextBox5.Text;
     oferta.Telefono_cel_opcional = TextBox6.Text;
     oferta.Telefono_fijo = TextBox7.Text;
     oferta.Correo = TextBox8.Text;
     oferta.Correo_opcional = TextBox9.Text;
     oferta.Informacion_adicional = TextBox10.Text;
     oferta.Fecha_limite = TextBox11.Text;
     oferta.editar();
     if (cod_tipo.Equals("1"))
     {
         Response.Redirect(Global.ruta + "/ofertas_academico.aspx");
     }
     else
     {
         Response.Redirect(Global.ruta + "/ofertas_empleo.aspx");
     }
 }
        public void cargar_ofertas_academicas()
        {
            Oferta[] ofertas = new Oferta().cargar_por_tipo("2");
            for (int i = 0; i < ofertas.Length; i++)
            {
                TableRow fila1 = new TableRow();
                TableCell celda = new TableCell();
                celda.CssClass = "td";
                celda.Text = ofertas[i].Oficio;
                TableCell celda1 = new TableCell();
                celda1.CssClass = "td";
                celda1.Text = ofertas[i].Entidad;
                TableCell celda2 = new TableCell();
                celda2.CssClass = "td";
                celda2.Text = Convert.ToDateTime(ofertas[i].Fecha).ToString("dd-MM-yyyy");
                TableCell celda3 = new TableCell();
                celda3.CssClass = "td";
                celda3.Text = Convert.ToDateTime(ofertas[i].Fecha_limite).ToString("dd-MM-yyyy");
                TableCell celda4 = new TableCell();
                celda4.CssClass = "td";
                HyperLink link = new HyperLink();
                link.Text = "Ir a la oferta";
                link.NavigateUrl = Global.ruta + "/mostrar_oferta.aspx?id=" + ofertas[i].Id;
                celda4.Controls.AddAt(0, link);
                TableCell celda7 = new TableCell();
                celda7.CssClass = "td";
                HyperLink link_usu = new HyperLink();
                link_usu.Text = ofertas[i].Usuario;
                celda7.Controls.AddAt(0, link_usu);

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

                TableCell celda5 = new TableCell();
                celda5.CssClass = "td";
                TableCell celda6 = new TableCell();
                celda6.CssClass = "td";
                if (ofertas[i].Cod_usuario.Equals(cod))
                {
                    ImageButton edit = new ImageButton();
                    edit.ImageUrl = "~/Imagenes/edit.png";
                    edit.CommandName = ofertas[i].Id;
                    edit.PostBackUrl = "~/Paginas/editar_oferta.aspx?tipo=2&ofe=" + ofertas[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=" + ofertas[i].Id + "&op=2', 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);
            }
        }
 public Oferta[] cargar_todos()
 {
     Oferta[] ofertas;
     ConexionMySql cone = new ConexionMySql();
     if (cone.conexion(false, "cadconex"))
     {
         DataSet data = cone.consulta("select id_oferta,oficio,entidad,direccion,telcel1,telcel2,telfijo,correo1,correo2,mas_info,nombre,fecha,fecha_limite from oferta inner join tipo_oferta as tpo on tpo.id_tipo_ofe=fk_tipo_ofe;");
         if (data != null)
         {
             ofertas = new Oferta[data.Tables[0].Rows.Count];
             for (int i = 0; i < ofertas.Length; i++)
             {
                 ofertas[i] = new Oferta();
                 ofertas[i].Id = Convert.ToString(data.Tables[0].Rows[0][0]); ofertas[i].Oficio = Convert.ToString(data.Tables[0].Rows[0][1]);
                 ofertas[i].Entidad = Convert.ToString(data.Tables[0].Rows[0][2]); ofertas[i].Direccion = Convert.ToString(data.Tables[0].Rows[0][3]);
                 ofertas[i].Telefono_cel = Convert.ToString(data.Tables[0].Rows[0][4]); ofertas[i].Telefono_cel_opcional = Convert.ToString(data.Tables[0].Rows[0][5]);
                 ofertas[i].Telefono_fijo = Convert.ToString(data.Tables[0].Rows[0][6]); ofertas[i].Correo = Convert.ToString(data.Tables[0].Rows[0][7]);
                 ofertas[i].Correo_opcional = Convert.ToString(data.Tables[0].Rows[0][8]); ofertas[i].Informacion_adicional = Convert.ToString(data.Tables[0].Rows[0][9]);
                 ofertas[i].Tipo = Convert.ToString(data.Tables[0].Rows[0][10]); ofertas[i].Cod_usuario = Convert.ToString(data.Tables[0].Rows[0][11]);
                 ofertas[i].Usuario = Convert.ToString(data.Tables[0].Rows[0][12]); ofertas[i].Fecha = Convert.ToString(data.Tables[0].Rows[0][13]);
                 ofertas[i].Fecha_limite = Convert.ToString(data.Tables[0].Rows[0][14]);
             }
             cone.desconectar();
             return ofertas;
         }
     }
     cone.desconectar();
     return null;
 }
 public Oferta[] cargar_por_tipo(String id_tipo)
 {
     Oferta[] ofertas;
     ConexionMySql cone = new ConexionMySql();
     if (cone.conexion(false, "cadconex"))
     {
         DataSet data = cone.consulta("select id_oferta,oficio,entidad,direccion,telcel1,correo1,nombre,fecha,fecha_limite,cod,concat(nombre1,' ',apellido1) from oferta inner join usuario as usu on usu.cod=fk_usu2 inner join tipo_oferta as tpo on tpo.id_tipo_ofe=fk_tipo_ofe where fk_tipo_ofe="+id_tipo+"  order by fecha desc;");
         if (data != null)
         {
             ofertas = new Oferta[data.Tables[0].Rows.Count];
             for (int i = 0; i < ofertas.Length; i++)
             {
                 ofertas[i] = new Oferta();
                 ofertas[i].Id = Convert.ToString(data.Tables[0].Rows[i][0]);
                 ofertas[i].Oficio = Convert.ToString(data.Tables[0].Rows[i][1]);
                 ofertas[i].Entidad = Convert.ToString(data.Tables[0].Rows[i][2]);
                 ofertas[i].Direccion = Convert.ToString(data.Tables[0].Rows[i][3]);
                 ofertas[i].Telefono_cel = Convert.ToString(data.Tables[0].Rows[i][4]);
                 ofertas[i].Correo = Convert.ToString(data.Tables[0].Rows[i][5]);
                 ofertas[i].Tipo = Convert.ToString(data.Tables[0].Rows[i][6]);
                 ofertas[i].Fecha = Convert.ToString(data.Tables[0].Rows[i][7]);
                 ofertas[i].Fecha_limite = Convert.ToString(data.Tables[0].Rows[i][8]);
                 ofertas[i].Cod_usuario = Convert.ToString(data.Tables[0].Rows[i][9]);
                 ofertas[i].Usuario = Convert.ToString(data.Tables[0].Rows[i][10]);
             }
             cone.desconectar();
             return ofertas;
         }
     }
     cone.desconectar();
     return null;
 }