private void ListarRegistro() { Resultado resultado = new Resultado(); try { List <Tabla> lista = new List <Tabla>(); Tabla tab = new Tabla(); tab.Tag = "LISTADO"; tab.Id_Escuela = usu.IdEscuela; resultado = new TablaLogica().Acciones(tab); if (resultado.TipoResultado == "OK") { lista = new List <Tabla>(); lista = (List <Tabla>)resultado.ObjetoResultado; imagenesList.DataSource = lista; imagenesList.DataBind(); } } catch (Exception ex) { string script = "swal('Error', '" + ex + "', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } }
private void ListarEstados() { Resultado resultado = new Resultado(); resultado = new TablaLogica().Estados(); List <Estado> lista = (List <Estado>)resultado.ObjetoResultado; estado.DataSource = lista; estado.DataTextField = "Descripcion"; estado.DataValueField = "Descripcion"; estado.DataBind(); }
private void ListarDificultad() { Resultado resultado = new Resultado(); resultado = new TablaLogica().Dificultad(); List <string> lista = (List <string>)resultado.ObjetoResultado; lista.Add("Seleccione la dificultad"); dificultadLst.DataSource = lista; dificultadLst.DataBind(); dificultadLst.SelectedValue = "Seleccione la dificultad"; }
private void ListarTipos() { Resultado resultado = new Resultado(); resultado = new TablaLogica().Tipos(); List <string> lista = (List <string>)resultado.ObjetoResultado; lista.Add("Seleccione un tipo"); tipoLst.DataSource = lista; tipoLst.DataBind(); tipoLst.SelectedValue = "Seleccione un tipo"; }
private void ListarMarcas() { Resultado resultado = new Resultado(); resultado = new TablaLogica().Marcas(); List <string> lista = (List <string>)resultado.ObjetoResultado; lista.Add("Seleccione una marca"); marcaLst.DataSource = lista; marcaLst.DataBind(); marcaLst.SelectedValue = "Seleccione una marca"; }
protected void reporteTablaSurf(object sender, EventArgs e) { Resultado resultado = new Resultado(); try { string marca = marcaLst.SelectedValue; string tipo = tipoLst.SelectedValue; string estado = estadoLst.SelectedValue; string dificultad = dificultadLst.SelectedValue; if (marca == "Seleccione una marca") { marca = ""; } if (tipo == "Seleccione un tipo") { tipo = ""; } if (estado == "Seleccione un estado") { estado = ""; } if (dificultad == "Seleccione la dificultad") { dificultad = ""; } resultado = new TablaLogica().Reporte(usu.IdEscuela, marca, tipo, estado, dificultad); if (resultado.TipoResultado == "OK") { listaTablas = null; imagenesList.DataSource = null; imagenesList.DataBind(); listaTablas = new List <Tabla>(); listaTablas = (List <Tabla>)resultado.ObjetoResultado; imagenesList.DataSource = listaTablas; imagenesList.DataBind(); } } catch (Exception ex) { string script = "swal('Error', '" + ex + "', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } }
private void selecion() { Resultado resultado = new Resultado(); try { List <Tabla> lista = new List <Tabla>(); Tabla tab = new Tabla(); tab.Tag = "LISTADO_ESCUELA_NO_VENTA"; tab.Id_Escuela = usu.IdEscuela; resultado = new TablaLogica().Acciones(tab); lista = (List <Tabla>)resultado.ObjetoResultado; if (resultado.TipoResultado == "OK") { if (lista.Count == 0) { string script = "swal('Lo sentimos', '" + "No se encontró ningun registro válido de tablas" + "', 'info'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); imagenesList.Visible = false; } else { imagenesList.DataSource = lista; imagenesList.DataBind(); imagenesList.Visible = true; } } else { string script = "swal('Lo sentimos', '" + "No se encontró ningun registro válido de tablas" + "', 'info'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); imagenesList.Visible = false; } } catch (Exception ex) { string script = "swal('Error', '" + ex + "', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } }
private void ListarEstados() { Resultado resultado = new Resultado(); resultado = new TablaLogica().Estados(); List <Estado> lista = (List <Estado>)resultado.ObjetoResultado; lista.Add(new Estado { Descripcion = "Seleccione un estado" }); estadoLst.DataSource = lista; estadoLst.DataTextField = "Descripcion"; estadoLst.DataValueField = "Descripcion"; estadoLst.DataBind(); estadoLst.SelectedValue = "Seleccione un estado"; }
private void ListarTablas() { Resultado resultado = new Resultado(); try { resultado = new TablaLogica().Reporte(usu.IdEscuela, "", "", "", ""); if (resultado.TipoResultado == "OK") { listaTablas = null; listaTablas = new List <Tabla>(); listaTablas = (List <Tabla>)resultado.ObjetoResultado; imagenesList.DataSource = listaTablas; imagenesList.DataBind(); } } catch (Exception ex) { string script = "swal('Error', '" + ex + "', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } }
protected void imagenesList_ItemDataBound(object sender, RepeaterItemEventArgs e) { DropDownList ddl = e.Item.FindControl("estadoList") as DropDownList; Label lbl = e.Item.FindControl("idTable") as Label; Label lblEst = e.Item.FindControl("est") as Label; Resultado resultado = new Resultado(); resultado = new TablaLogica().Estados(); List <Estado> lista = (List <Estado>)resultado.ObjetoResultado; lista.Add(new Estado { Descripcion = "Seleccione un estado" }); ddl.DataSource = lista; ddl.DataTextField = "Descripcion"; ddl.DataValueField = "Descripcion"; ddl.DataBind(); ddl.SelectedValue = "Seleccione un estado"; idTabla = lbl.Text; }
protected void estadoList_SelectedIndexChanged(object sender, EventArgs e) { if (((DropDownList)sender).SelectedValue != "Seleccione un estado") { Resultado resultado = new Resultado(); try { List <Tabla> lista = new List <Tabla>(); Tabla tab = new Tabla(); tab.Tag = "CAMBIA_ESTADO"; tab.Id_Escuela = usu.IdEscuela; tab.Id = idTabla; tab.Estado = ((DropDownList)sender).SelectedValue; resultado = new TablaLogica().Acciones(tab); if (resultado.TipoResultado != "OK") { string script = "swal('Lo sentimos', '" + "No se encontró ningun registro válido de tablas" + "', 'info'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); imagenesList.Visible = false; } else { selecion(); } } catch (Exception ex) { string script = "swal('Error', '" + ex + "', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } } }
protected void btnGuardar_Click(object sender, EventArgs e) { Tabla tabla = new Tabla(); Resultado resultado = new Resultado(); string Extension = string.Empty; string Nombre = string.Empty; if (FileUpload.HasFile == false) { string script = "swal('Error', ' No puede faltar la imagen ', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); return; } Nombre = FileUpload.FileName; Extension = Path.GetExtension(Nombre); if (ValidarExtension(Extension)) { tabla.Marca = txtMarca.Text; tabla.Tamanio = txtPies.Text + "-" + txtPulgadas.Text; tabla.Tipo = txtTipo.Text; tabla.Estado = estado.SelectedValue; tabla.Id_Escuela = usu.IdEscuela; if (Convert.ToInt32(txtPies.Text) >= 9) { tabla.Tipo_precio = "LONG"; } else { tabla.Tipo_precio = "SHORT"; } string base64ImageRepresentation = Convert.ToBase64String(FileUpload.FileBytes); tabla.Imagen = base64ImageRepresentation; tabla.Dificultad = dificultad.SelectedValue; tabla.Tag = "INSER_ACTUA"; } else { string script = "swal('Error', ' El archivo no es de tipo imagen. ', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); return; } try { if (Validar()) { resultado = new TablaLogica().Acciones(tabla); if (resultado.TipoResultado == "OK") { //string script = "swal('Excelente', 'Éxito en la insersión', 'success'); "; //ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); //Limpiar(); //ListarRegistro(); Session["RegistroTabla"] = "OK"; Response.Redirect("mantTablas.aspx"); } else { string script = "swal('Lo sentimos, ha ocurrido un error', '" + resultado.Mensaje + "', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } } } catch (Exception) { string script = "swal('Error', 'Lo sentimos por lo sucedido', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } }