protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { EntUsuario user = (EntUsuario)Session["USUARIO"]; if (user != null) { Label lbl = (Label)Master.FindControl("lblUsuario"); lbl.Text = "Bienvenido " + user.nombre; HtmlContainerControl lblModal = (HtmlContainerControl)Master.FindControl("lblModal"); lblModal.InnerText = ""; } else { Response.Redirect("Cinepol.aspx"); } CargarDDLClas(); CargarDDLGene(); CargarDDLAnio(); int id = Convert.ToInt32(Request.QueryString["id"]); //recupera el id de la pelicula seleccionada if (id != 0) { btnActualizar.Visible = true; btnAgregar.Visible = false; btnBorrar.Visible = true; EntCine ent = new BusCine().obtener(id); imgFotoPort.ImageUrl = ent.fotoPort; hfFotoPort.Value = ent.fotoPort; //recupera el valor de foto de portada para poder usarla en algun otro lado ImgFotoMini.ImageUrl = ent.fotoMini; hfFotoMini.Value = ent.fotoMini; IfVideo.Src = ent.video; txtVideo.Text = ent.video; txtNomb.Text = ent.nombre; txtProd.Text = ent.productor; chkEsta.Checked = ent.estatus; txtSino.Text = ent.sinopsis; ddlClas.SelectedValue = ent.clasificacionId.ToString(); ddlGenero.SelectedValue = ent.generoId.ToString(); } else { btnActualizar.Visible = false; btnAgregar.Visible = true; btnBorrar.Visible = false; } } } catch (Exception ex) { MostrarMensaje(ex.Message); } }
private void CargarGridPelicula(int?fila, string columna, string direccion) { List <EntCine> lst = new BusCine().ObtenerPelicula(); if (columna != "" && direccion != "") { if (direccion == "ASC") { gvPeliculas.DataSource = lst.OrderBy(X => X.nombre).ToList();//aqui se ordena la lista de nombres con una exprecion lamda } else { gvPeliculas.DataSource = lst.OrderByDescending(X => X.nombre).ToList(); } gvPeliculas.DataBind(); } else { gvPeliculas.DataSource = lst; gvPeliculas.DataBind(); } int contador = 0; foreach (GridViewRow dr in gvPeliculas.Rows) { if (fila == contador && fila != null) { contador++; continue; } else { Label lbl = (Label)gvPeliculas.Rows[contador].FindControl("ITlblSinopsis"); lbl.Text = lbl.Text.Length > 50 ? lbl.Text.Substring(0, 50) : lbl.Text; contador++; } } CargarDDLS(); }
private void CargarCarruselDos() { List <EntCine> lista = new BusCine().ObtenerEstrenos(); LiteralControl literal = new LiteralControl(); literal.Text = ""; int contador = 0; foreach (EntCine ent in lista) { literal = new LiteralControl(); if (contador == 0) { literal.Text += "<li data-target=\"#Estrenos\" data-slide-to=\"" + contador + "\" class=\"active\"></li>"; } else { literal.Text += "<li data-target=\"#Estrenos\" data-slide-to=\"" + contador + "\"></li>"; } phtres.Controls.Add(literal); literal = new LiteralControl(); if (contador == 0) { literal.Text += " <div class=\"item active\">"; } else { literal.Text += " <div class=\"item\">"; } literal.Text += "<img src=\"" + ent.fotoPort + "\" alt=\"Chania\" />"; literal.Text += "<div class=\"carousel-caption\">"; literal.Text += "<h3>" + ent.nombre + "</h3>"; literal.Text += "<p>" + ent.sinopsis.Substring(0, 20) + "</p>"; literal.Text += "</div>"; literal.Text += "</div>"; phcuatro.Controls.Add(literal); contador++; } }
protected void btnEntrar_Click(object sender, EventArgs e) { try { EntUsuario user = new BusCine().Validar(txtMail.Text, txtPassword.Text); if (user != null) { Session["USUARIO"] = user; lblUsuario.Text = "Bienvenido " + user.nombre; lblModal.InnerText = ""; } else { lblModal.InnerText = "Login"; } } catch (Exception ex) { MostrarMensaje(ex.Message); } }
private void CargarPelicula() { List <EntCine> lista = new BusCine().ObtenerPelicula(); LiteralControl literal = new LiteralControl(); literal.Text = ""; foreach (EntCine ent in lista) { literal.Text += "<div class=\"col-md-4\">"; literal.Text += "<div class=\"panel panel-info\">"; literal.Text += "<div class=\"panel-heading\" style = \"height:207px; overflow-y:hidden;\">"; literal.Text += "<a href=\"Altas.aspx?id=" + ent.id + "\" title=\"Editar Pelicula\"><img src=\"" + ent.fotoPort + "\" class=\"img-responsive\" alt=\"\" /></a>"; literal.Text += "<h3 class=\"panel-title\"></h3>"; literal.Text += "</div>"; literal.Text += "<div class=\"panel-body\" style =\"height: 300px;\">"; literal.Text += "<div class=\"row\">"; literal.Text += "<div class=\"col-xs-4\">"; literal.Text += "<img src=\"" + ent.fotoMini + "\" alt=\"\" class=\"img-responsive\" />"; literal.Text += "</div>"; literal.Text += "<div class=\"col-xs-8\">"; literal.Text += "Nombre : <span>" + ent.nombre + "</span><br />"; literal.Text += "Genero : <span>" + ent.Genero.nombre + "</span><br />"; literal.Text += "Clasificacion : <span>" + ent.Clas.nombre + "</span><br />"; literal.Text += "Productor : <span>" + ent.productor + "</span><br />"; literal.Text += "</div>"; literal.Text += "</div>"; literal.Text += "<hr />"; literal.Text += "<p style=\"height:100px; overflow-y:scroll;\">" + ent.sinopsis + "</p>"; literal.Text += "</div>"; literal.Text += "<div class=\"panel-footer\">"; literal.Text += "<iframe class=\"img-responsive\" style=\"margin: auto\" src=\"" + ent.video + "\" frameborder=\"0\" allowfullscreen=\"\"></iframe>"; literal.Text += "</div>"; literal.Text += "</div>"; literal.Text += "</div>"; } phpelis.Controls.Add(literal); }