コード例 #1
0
        protected void btnCrearNuevo_Click(object sender, EventArgs e)
        {
            CuandoTocan.evento ev = new CuandoTocan.evento();
            ev.id_artista = id_artista;
            ev.titulo = txtNameNuevo.Text;
            ev.descripcion = tvtDescNueva.Text;
            ev.fecha_alta = DateTime.Now;
            ev.fecha_evento = Convert.ToDateTime(txtFechaNueva.Text);
            ev.id_locacion = Convert.ToInt32(ddlLugar2.SelectedValue);
            ev.tipo_evento = Convert.ToInt32(ddlTIpo2.SelectedValue);

            ct.AddToevento(ev);
            ct.SaveChanges();

            Response.Redirect(Request.RawUrl);
        }
コード例 #2
0
        protected void btnCrearEvento_Click(object sender, EventArgs e)
        {
            Page.Validate("crearEvento");

            if (Page.IsValid)
            {
                CuandoTocan.CuandoTocanEntities ct = new CuandoTocan.CuandoTocanEntities();

                CuandoTocan.evento ev = new CuandoTocan.evento();

                //int id_Usuario = Convert.ToInt32(Request.QueryString["id_usuario"]);
                int id_Usuario = Convert.ToInt32(Session["id_usua"]);

                var usuarioBanda = (from art in ct.artista
                                    join usu in ct.usuario on art.id_artista equals usu.id_artista
                                    where usu.id_usuario == id_Usuario
                                    select art);

                foreach (var a in usuarioBanda)
                {
                    ev.id_artista = a.id_artista;
                    ev.titulo = txtNameNuevo.Text;
                    ev.descripcion = txtDescNueva.Text;
                    ev.fecha_alta = DateTime.Now;
                    ev.fecha_evento = Convert.ToDateTime(txtFechaNueva.Text);
                    ev.id_locacion = Convert.ToInt32(ddlLugarCrear.SelectedValue);
                    ev.tipo_evento = Convert.ToInt32(ddlTipoCrear.SelectedValue);
                }

                ct.AddToevento(ev);
                ct.SaveChanges();

                //ANA envío mail de nuevo evento a seguidores del artista

                serv.MandarMailNewE(ev.id_artista, ev.id_evento);

                //ANA Falta programar el envio este

                Response.Redirect(Request.RawUrl);
            }
        }