private void actualizarCombos() { cmbUsuarios.DataSource = null; cmbUsuarios.DataSource = GestionarUsuario.Listar(); cmbRoles.DataSource = null; cmbRoles.DataSource = gestorRolesPerfiles.ListarPerfilesPadres(); }
protected void Page_Load(object sender, EventArgs e) { GestionarUsuario GestUser = new GestionarUsuario(); if (GestUser.ValidateSesion()) { btnComprar.Enabled = true; GestionarVehiculos GestVehiculos = new GestionarVehiculos(); this.LstVehiculos = GestVehiculos.ConsultarVehiculos(); if (ListaVehiculos.Items.Count == 0) { if (ListaVehiculos != null) { //Inicial ListaVehiculos.Items.Add(new ListItem("Seleccione vehículo", "0")); foreach (Vehiculo Vehicle in LstVehiculos) { ListItem oItem = new ListItem(Vehicle.Marca + " - " + Vehicle.Modelo, Convert.ToString(Vehicle.Id)); //Objeto droplist ListaVehiculos.Items.Add(oItem); } } } } else { btnComprar.Enabled = false; LblResultado.Text = "Sesión invalida, pruebe saliendo e ingresando de nuevo."; } }
protected void Page_Load(object sender, EventArgs e) { GestionarUsuario GestUser = new GestionarUsuario(); LblResultado.Text = ""; txtIdcompra.Enabled = false; BtnFacturar.Enabled = false; if (GestUser.ValidateSesion()) { /*GestionarVentas GestVentas = new GestionarVentas(); * List<Models.SP_ConsultarEstadisticasVentas_Result> LstEstadisticas = GestVentas.ConsultarEstadisticas(); * GridViewCompras.DataSource = LstEstadisticas; * GridViewCompras.DataBind();*/ GestionarCompra GestCompra = new GestionarCompra(); List <Models.SP_ConsultarCompras_Result> LstCompras = GestCompra.ConsultarCompras(); GridViewCompras.DataSource = LstCompras; GridViewCompras.DataBind(); txtIdcompra.Enabled = true; BtnFacturar.Enabled = true; } else { LblResultado.Text = "Sesión invalida, pruebe saliendo e ingresando de nuevo."; } }
protected void Page_Load(object sender, EventArgs e) { GestionarUsuario GestUser = new GestionarUsuario(); if (GestUser.ValidateSesion()) { GestionarVehiculos GestVehiculos = new GestionarVehiculos(); var LstVehiculos = from ListVehicles in GestVehiculos.ConsultarVehiculos() orderby ListVehicles.Cantidad ascending select ListVehicles; GridViewPedidos.DataSource = LstVehiculos.ToList(); /*DataGridViewButtonColumn colBotones = new DataGridViewButtonColumn(); * colBotones.Name = "colBotones"; * colBotones.HeaderText = "Valor Stock";*/ GridViewPedidos.DataBind(); } else { LblResultado.Text = "Sesión invalida, pruebe saliendo e ingresando de nuevo."; } }
protected void btnIniciarSesion_Click(object sender, EventArgs e) { try { GestionarUsuario objGestionarUsuario = new GestionarUsuario(); Usuario objUsuario = objGestionarUsuario.VerificarAcceso(txtNombreUsuario.Text, txtContraseña.Text); if (objUsuario != null) { if (objUsuario.EsActivo()) { Session["usuario"] = objUsuario; Response.Redirect("index.aspx"); } else { Response.Write("<script>alert('Lo sentimos, su usuario a sido dado de baja.')</script>"); } } else { Response.Write("<script>alert('Usuario o Contraseña Incorrectos, intentelo nuevamente')</script>"); } } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { GestionarUsuario GestUser = new GestionarUsuario(); LblResultado.Text = ""; LblTotalVentas.Text = "0"; LblVehiculosVendidos.Text = "0"; if (GestUser.ValidateSesion()) { GestionarVentas GestVentas = new GestionarVentas(); List <Models.SP_ConsultarEstadisticasVentas_Result> LstEstadisticas = GestVentas.ConsultarEstadisticas(); GridViewEstadisticas.DataSource = LstEstadisticas; GridViewEstadisticas.DataBind(); decimal VentasTotales = 0; int VehiculosVendidos = 0; foreach (SP_ConsultarEstadisticasVentas_Result Estadistica in LstEstadisticas) { VentasTotales += Convert.ToDecimal(Estadistica.Total_Ventas); VehiculosVendidos += Convert.ToInt32(Estadistica.Cantidad); } LblTotalVentas.Text = Convert.ToString(VentasTotales); LblVehiculosVendidos.Text = Convert.ToString(VehiculosVendidos); } else { LblResultado.Text = "Sesión invalida, pruebe saliendo e ingresando de nuevo."; } }
protected void Btnguardar_Click(object sender, EventArgs e) { GestionarUsuario GestionarUser = new GestionarUsuario(); Usuario ObjUsuario = new Usuario() { User = txtUser.Text, Password = txtPassword.Text, Rol = Convert.ToInt32(ListTipoUsuario.SelectedValue), Identificacion = txtIdentificacion.Text, Nombre = txtNombre.Text, Apellidos = txtApellidos.Text, Correo = txtCorreo.Text, Direccion = txtDireccion.Text, Telefono = txtTelefono.Text, NroCuenta = txtNroCuenta.Text }; if (ObjUsuario.User.Length > 0 && ObjUsuario.Password.Length > 0 && ObjUsuario.Rol > 0 && ObjUsuario.Identificacion.Length > 0 && ObjUsuario.Nombre.Length > 0 && ObjUsuario.Apellidos.Length > 0 && ObjUsuario.Correo.Length > 0 && ObjUsuario.Direccion.Length > 0 && ObjUsuario.Telefono.Length > 0 && ObjUsuario.NroCuenta.Length > 0 ) { if (!ValidarCampoNumerico(ObjUsuario.Identificacion) || !ValidarCampoNumerico(ObjUsuario.Telefono) || !ValidarCampoNumerico(ObjUsuario.NroCuenta)) { lblresultado.Text = "Los campos Identificación, Telefono y Número de cuenta son de tipo Numerico."; } else { if (GestionarUser.IsValidEmail(ObjUsuario.Correo)) { if (GestionarUser.ValidarUsuarioExiste(ObjUsuario)) { GestionarUser.GuardarUsuario(ObjUsuario); lblresultado.Text = "Usuario registrado con éxito."; } else { lblresultado.Text = "Ya existe un usuario con el mismo nombre de usuario o identificación."; } } else { lblresultado.Text = "Formato de correo inválido."; } } } else { lblresultado.Text = "Todos los campos del formulario son obligatorios."; } }
private void Bitacora_Load(object sender, EventArgs e) { gb = new GestionarBitacora(); lista = gb.Listar(); comboBox1.Items.Add(""); foreach (var item in GestionarUsuario.Listar()) { comboBox1.Items.Add(item); } Actualizar(lista); dateTimePicker1.MaxDate = DateTime.Now; dateTimePicker2.MaxDate = DateTime.Now; }
private void btnAceptar_Click(object sender, EventArgs e) { int respuesta; try { if (this.ValidarTextbox()) { if (!txtPass.Text.Equals(txtPass2.Text)) { Mensaje("msgErrorPassNoIguales", "msgError"); return; } Usuario usr = new Usuario(); usr.Login = txtUsuario.Text.Trim(); usr.Password = txtPass.Text.Trim(); usr.Nombre = txtNombre.Text.Trim(); usr.Apellido = txtApellido.Text.Trim(); usr.Correo = txtCorreo.Text.Trim(); usr.Dni = int.Parse(txtDni.Text.Trim()); if (txtUsuario.Enabled) { respuesta = GestionarUsuario.Insertar(usr); List <iPermisos> permisos = new List <iPermisos>(); permisos.Add((iPermisos)cmbPerfil.SelectedItem); gestor.InsertarUsuarioPerfil(usr, permisos); } else { respuesta = GestionarUsuario.Modificar(usr, encriptado.Equals(usr.Password)); } if (respuesta == 0) { Mensaje("msgErrorAlta", "msgError"); } else { Mensaje("msgOperacionOk"); } ActualizarLista(); btnNuevo_Click(null, null); } } catch (Exception) { Mensaje("errorDatoMal", "msgFaltaCompletarTitulo"); } }
protected void btnValidar_Click(object sender, EventArgs e) { GestionarUsuario GestionarUser = new GestionarUsuario(); if (txtUsuario.Text.Trim().Length > 0 && txtClave.Text.Trim().Length > 0) { Usuario ObjUsuario = GestionarUser.ValidarUsuarioLogin(txtUsuario.Text, txtClave.Text); if (ObjUsuario.StatusLogin) { ObjUsuario.User = txtUsuario.Text; ObjUsuario.Password = txtClave.Text; lblresultado.Text = "Usuario valido."; //Se verifica el tipo de usuario logueado y se le muestra la pantalla correspondiente a el rol System.Web.HttpContext.Current.Session["sessionString"] = ObjUsuario.Identificacion; if (ObjUsuario.Rol == Convert.ToInt32(TipoUsuario.Cliente)) { Response.Redirect("Compra.aspx"); } else { //Caso Jefe de Taller Response.Redirect("Venta.aspx"); } } else { lblresultado.Text = "Usuario no registrado, para realizar el registro de clic en el vínculo."; } } else { lblresultado.Text = "Los campos Usuario y Contraseña son obligatorios."; } }
private void ActualizarLista() { listBox1.DataSource = null; listBox1.DataSource = GestionarUsuario.Listar(); }