private void cargarGrid(int estado) { IEnumerable <CentroAcopio> lista = (IEnumerable <CentroAcopio>)CentroAcopioLN.ListaCentrosAcopio(estado); grvListado.DataSource = lista.ToList(); grvListado.DataBind(); }
protected void btnOrdenar_Click(object sender, EventArgs e) { //buscar el centro que tenga el usuario logeado //Usuario usuario = UsuarioLN.obtenerUsuario("*****@*****.**"); Usuario usuario2 = (Usuario)Session["usuario"]; CentroAcopio centro = CentroAcopioLN.obtenerUsuariodeCentroAcopio(usuario2.Id_Usuario); Usuario cliente = UsuarioLN.obtenerUsuario(ddlClientes.SelectedValue); if (grvCarrito.Rows.Count >= 1) { if (OrdenCompraLN.registrarOrden (ddlClientes.SelectedValue, centro.Id_Centro, Carrito.Instancia.Items)) { BilleteraLN.AgregarBilletera(cliente.Billetera.Id_Billetera, 0, Convert.ToInt32(Carrito.Instancia.GetTotal())); Carrito.Instancia.eliminarCarrito(); Response.Redirect("AdministradorCentro.aspx?accion=registro"); } } else { lblMensaje.Visible = true; lblMensaje.Text = "No existen canjes para guardar"; } }
public void cargarGrid() { IEnumerable <CentroAcopio> lista = (IEnumerable <CentroAcopio>)CentroAcopioLN.listaCentros(); grvListado.DataSource = lista.ToList(); grvListado.DataBind(); }
protected void btnGuardar_Click(object sender, EventArgs e) { //guardar Centro CentroAcopioLN centro = new CentroAcopioLN(); bool estado = true; if (RadioButton1.Checked) { estado = true; } else { if (RadioButton2.Checked) { estado = false; } } bool confirmarGuardar = CentroAcopioLN.AgregarCentroAcopio(txtNombre.Text, txtDireccion.Text, ddlAdministrador.SelectedValue, ddlProvincia.SelectedValue, estado, hiddenID.Value); if (confirmarGuardar) { //recarga la pagina Response.Redirect("MantCentroAcopio.aspx?accion=guardar"); } else { lblMensaje.Visible = true; lblMensaje.Text = "No se puede guardar el centro de acopio"; } }
protected void grvListado_SelectedIndexChanged(object sender, EventArgs e) { ddlAdministrador.Items.Clear(); int id = Convert.ToInt32(grvListado.DataKeys[grvListado.SelectedIndex].Values[0] ); CentroAcopio centro = CentroAcopioLN.obtenerCentroAcopio(id); txtNombre.Text = centro.nombre; ddlProvincia.SelectedValue = centro.Id_Provincia.ToString(); Usuario usu = UsuarioLN.obtenerUsuario(centro.Id_Usuario); IEnumerable <Usuario> listaAdmi = UsuarioLN.listaAdministradores(); List <Usuario> lista2 = (List <Usuario>)listaAdmi.ToList(); lista2.Add(usu); ddlAdministrador.DataSource = lista2; ddlAdministrador.DataBind(); ddlAdministrador.SelectedValue = centro.Id_Usuario.ToString(); hiddenID.Value = centro.Id_Centro.ToString(); txtDireccion.Text = centro.direccionExacta; if (centro.activo == true) { RadioButton1.Checked = true; } else { RadioButton1.Checked = false; } btnGuardar.Text = "Actualizar"; }
private void cargarGrid() { Usuario usuario2 = (Usuario)Session["usuario"]; CentroAcopio centro = CentroAcopioLN.obtenerUsuariodeCentroAcopio(usuario2.Id_Usuario); IEnumerable <Enca_Factura> lista = (IEnumerable <Enca_Factura>)Enca_FacturaLN.listaEnca_FacturaporCentro(centro.Id_Centro); grvListado.DataSource = lista.ToList(); grvListado.DataBind(); }
//protected void cvNombre_ServerValidate(object source, ServerValidateEventArgs args) //{ // args.IsValid = (args.Value.Length >= 3); //} protected void btnRegistrar_Click1(object sender, EventArgs e) { Boolean archivoOK = false; String path = Server.MapPath("~/Imagenes/"); if (archivoImagen.HasFile) { String fileExtension = System.IO.Path.GetExtension(archivoImagen.FileName).ToLower(); String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { archivoOK = true; } } } if (archivoOK) { try { archivoImagen.PostedFile.SaveAs(path + "CentrosAcopio/" + archivoImagen.FileName); } catch (Exception ex) { lblMensaje.Visible = true; lblMensaje.Text = ex.Message; } CentroAcopioLN centros = new CentroAcopioLN(); bool confirmacion = centros.GuardarCentroAcopio(txtNombre.Text, DDLAdmiCentro.SelectedValue, DDLProvincia.SelectedValue, archivoImagen.FileName, txtDireccion.Text, chkEstado.Checked, txtCorreo.Text, hfCentroID.Value); if (confirmacion) { CorreoLN cor = new CorreoLN(); Usuario us = UsuarioLN.obtenerUsuario(DDLAdmiCentro.SelectedValue); cor.EnviarCorreoCentroUsuario(us, txtNombre.Text, txtDireccion.Text); this.Response.Redirect("MantenimientoCentrosAcopio.aspx?accion=guardado"); } else { lblMensaje.Visible = true; lblMensaje.Text = "No se puede guardar el centro de acopio"; } } else { lblMensaje.Visible = true; lblMensaje.Text = "La extension o la imagen no es válida"; } }
protected void btnBuscar_Click(object sender, EventArgs e) { Usuario usuario2 = (Usuario)Session["usuario"]; CentroAcopio centro = CentroAcopioLN.obtenerUsuariodeCentroAcopio(usuario2.Id_Usuario); string termino = txtBuscar.Text; IEnumerable <Enca_Factura> lista = (IEnumerable <Enca_Factura>)Enca_FacturaLN.listaEnca_FacturaporCentro(centro.Id_Centro); grvListado.DataSource = lista.ToList().Where(x => x.Usuario.NombreCompleto.Contains(termino)); grvListado.DataBind(); }
private string buscarNombreCentro(string idUsuario) { CentroAcopio centro = CentroAcopioLN.obtenerCentroAcopioPorID(idUsuario); if (centro == null) { Session["Usuario"] = null; Response.Redirect("InicioE.aspx"); } lblCentroAcopio.Text = centro.Nombre; return(centro.Nombre); }
protected void grvListado_SelectedIndexChanged(object sender, EventArgs e) { int id = Convert.ToInt32(grvListado.DataKeys[grvListado.SelectedIndex].Values[0]); CentroAcopio centrAcopio = CentroAcopioLN.obtenerCentroAcopio(id); //Aqui se le indican los valores en las distintos controles del form txtNombre.Text = centrAcopio.Nombre; listaUsuarios(centrAcopio.UsuarioID); DDLProvincia.SelectedValue = centrAcopio.ProvinciaID.ToString(); txtDireccion.Text = centrAcopio.DireccionExacta; txtCorreo.Text = centrAcopio.Correo; chkEstado.Checked = centrAcopio.Estado; Image1.ImageUrl = "~/Imagenes/CentrosAcopio/" + centrAcopio.Imagen; hfCentroID.Value = centrAcopio.ID.ToString(); btnRegistrar.Text = "Actualizar"; }
protected void logIN_Click(object sender, EventArgs e) { if (LogIn.SesionUsr.iniciarSesion(usrID.Text, senha.Text)) { Usuario usuario = (Usuario)Session["usuario"]; CentroAcopio centro = CentroAcopioLN.obtenerUsuariodeCentroAcopio(usuario.Id_Usuario); if (usuario.Rol.Id_Rol == 1) { Response.Redirect("PerfilAdmin.aspx"); } else { if (usuario.Rol.Id_Rol == 2) { if (centro != null && centro.activo == true) { Response.Redirect("PerfilAdmnCA.aspx"); } else { mensaje.Visible = true; mensaje.Text = "El centro de acopio al que pertenece ya no se encuentra activo"; } } else { Response.Redirect("MiPerfil.aspx"); } } //Response.Redirect() } else { mensaje.Visible = true; mensaje.Text = "Usuario on contraseña incorrectos. Intentelo de nuevo."; } }
public IEnumerable <CentroAcopio> listadoCentro() { return(CentroAcopioLN.listaCentros()); }
public IEnumerable <CentroAcopio> GetCentrosAcopio() { IEnumerable <CentroAcopio> lista = (IEnumerable <CentroAcopio>)CentroAcopioLN.ListaCentrosAcopio(2); return(lista); }