public PartesVM(Pedido pedido) { bbdd = new ServicioBaseDatos(); PEDIDO = pedido; PARTES = bbdd.ObtenerPartes(CONDICION_FIJA, PEDIDO.IDPEDIDO, false); FORMULARIO = new Parte(); SITUACIONESPARTE = new ObservableCollection <string> { "Todos", "Abierto", "Cerrado" }; AÑOS = new ObservableCollection <string>(); AÑOS.Add(""); AÑOS.Add(DateTime.Now.Year.ToString()); for (int i = 2020; i <= 2040; i++) { if (i.ToString() != DateTime.Now.Year.ToString()) { AÑOS.Add(i.ToString()); } } MESES = new ObservableCollection <string>(); MESES.Add(""); MESES.Add(DateTime.Now.Month.ToString()); for (int i = 1; i <= 12; i++) { if (i.ToString() != DateTime.Now.Month.ToString()) { MESES.Add(i.ToString()); } } }
async void btnEliminar_Clicked(object sender, EventArgs e) { if (tarea.Id > 0) { var confirmar = await DisplayAlert("¿Eliminar Tarea?", "¿Estás seguro de eliminar esta tarea?", "Sí", "No"); if (confirmar) { var bd = new ServicioBaseDatos(); bool op = await bd.EliminarTarea(tarea.Id); if (op) { await DisplayAlert("Éxito", "Tarea eliminada con éxito", "OK"); await Navigation.PopAsync(true); } else { await DisplayAlert("Error", "Tarea no eliminada", "OK"); } } } else { await DisplayAlert("Error", "Selecciona una tarea para eliminar", "OK"); } }
public MantenimientoAyudaVM() { bbdd = new ServicioBaseDatos(); LISTA = bbdd.ObtenerTablaAyuda(false); FORMULARIO = new TablaAyuda(); ACCION = Modo.Insertar; }
public PerfilesVM() { bbdd = new ServicioBaseDatos(); PERFILES = bbdd.ObtenerPerfiles(false); FORMULARIO = new Perfil(); ACCION = Modo.Insertar; }
public ProvinciasVM() { bbdd = new ServicioBaseDatos(); PROVINCIAS = bbdd.ObtenerProvincias(false); FORMULARIO = new Provincia(); ACCION = Modo.Insertar; }
public PedidosVM() { bbdd = new ServicioBaseDatos(); PEDIDOS = bbdd.ObtenerPedidos(CONDICION_FIJA, false); FORMULARIO = new Pedido(); // Datos para filtrado SITUACIONESELECCIONADA = new SituacionPedido(); TIPOPEDIDOESELECCIONADA = new TipoPedido(); SITUACIONESPEDIDO = bbdd.ObtenerSituacionPedidos(false); TIPOSPEDIDO = bbdd.ObtenerTipoPedido(true); AÑOS = new ObservableCollection <string>(); AÑOS.Add(""); AÑOS.Add(DateTime.Now.Year.ToString()); for (int i = 2020; i <= 2040; i++) { if (i.ToString() != DateTime.Now.Year.ToString()) { AÑOS.Add(i.ToString()); } } MESES = new ObservableCollection <string>(); MESES.Add(""); MESES.Add(DateTime.Now.Month.ToString()); for (int i = 1; i <= 12; i++) { if (i.ToString() != DateTime.Now.Month.ToString()) { MESES.Add(i.ToString()); } } }
public Utilidades() { ServicioBaseDatos bbdd = new ServicioBaseDatos(); InitializeComponent(); DataContext = this; }
async void CargarEmocion() { Loading(true); var bd = new ServicioBaseDatos(); emocion = await bd.ObtenerEmocion(); if (emocion == null) { emocion = new Emocion() { Id = 0, Nombre = "", Score = 0, Foto = "" }; ToolbarItems.RemoveAt(1); } else { btnAnalizar.IsEnabled = true; } BindingContext = emocion; Loading(false); }
async void btnEliminar_Clicked(object sender, EventArgs e) { if (emocion.Id > 0) { var confirmar = await DisplayAlert("¿Eliminar Rating?", "¿Estás seguro de eliminar tu rating?", "Sí", "No"); if (confirmar) { var bd = new ServicioBaseDatos(); bool op = await bd.EliminarEmocion(); if (op) { await DisplayAlert("Éxito", "Rating eliminado con éxito", "OK"); await Navigation.PopAsync(true); } else { await DisplayAlert("Error", "Rating no eliminado", "OK"); } } } else { await DisplayAlert("Error", "No hay rating por eliminar", "OK"); } }
async void btnRegistrar_Clicked(object sender, EventArgs e) { if (emocion.Score > 0) { var bd = new ServicioBaseDatos(); bool op = (emocion.Id > 0) ? await bd.ActualizarEmocion(emocion) : await bd.AgregarEmocion(emocion); if (op) { await DisplayAlert("Éxito", "Operación realizada con éxito", "OK"); await Navigation.PopAsync(true); } else { await DisplayAlert("Error", "Rating no registrado", "OK"); } } else { await DisplayAlert("Error", "Debes analizar una foto primero.", "OK"); } }
public CargosVM() { bbdd = new ServicioBaseDatos(); CARGOS = bbdd.ObtenerCargos(false); CARGOFORMULARIO = new Cargo(); ACCION = Modo.Insertar; }
public DepartamentoVM() { bbdd = new ServicioBaseDatos(); DEPARTAMENTOS = bbdd.ObtenerDepartamentos(false); DEPARTAMENTOFORMULARIO = new Departamento(); ACCION = Modo.Insertar; }
public UsuariosVM() { bbdd = new ServicioBaseDatos(); USUARIOS = bbdd.ObtenerUsuarios(false); FORMULARIO = new Usuario(); ACCION = Modo.Insertar; // Obtener valores para los combobox ObtenerDatosCombo(); }
public ProductosPedidoVM(Pedido pedido) { PEDIDO = pedido; bbdd = new ServicioBaseDatos(); PRODUCTOSPEDIDO = bbdd.ObtenerProductoPedido(false, PEDIDO.IDPEDIDO); FORMULARIO = new ProductoPedido(PEDIDO); ACCION = Modo.Insertar; // Obtener valores para los combobox ObtenerDatosCombo(); }
protected async override void OnAppearing() { Loading(true); base.OnAppearing(); var bd = new ServicioBaseDatos(); lsvTareas.ItemsSource = await bd.ObtenerTareas(); Loading(false); }
protected async override void OnAppearing() { base.OnAppearing(); Loading(true); var bd = new ServicioBaseDatos <Escuela>(); lsvEscuelas.ItemsSource = await bd.ObtenerTabla(); Loading(false); }
public PaginaAlumno(Alumno alumno) { InitializeComponent(); this.BindingContext = alumno; bd = new ServicioBaseDatos <Alumno>(); if (alumno.Id == 0) { this.ToolbarItems.RemoveAt(1); } }
public PaginaEscuela(Escuela escuela) { InitializeComponent(); this.BindingContext = escuela; bd = new ServicioBaseDatos <Escuela>(); if (escuela.Id == 0) { this.ToolbarItems.RemoveAt(2); this.ToolbarItems.RemoveAt(1); } }
async void btnLogin_Clicked(object sender, EventArgs e) { try { Loading(true); var foto = await ServicioImagen.TomarFoto(); if (foto != null) { imagen.Source = ImageSource.FromStream(foto.GetStream); var faceId = await ServicioFace.DetectarRostro(foto.GetStream()); var personId = await ServicioFace.IdentificarEmpleado(faceId); if (personId != Guid.Empty) { var bd = new ServicioBaseDatos(); var usuario = await bd.ObtenerUsuario(personId.ToString()); usuario.FotoActual = foto.Path; var emocion = await ServicioFace.ObtenerEmocion(foto); usuario.EmocionActual = emocion.Nombre; usuario.ScoreActual = emocion.Score; var update = await bd.ActualizarUsuario(usuario); await DisplayAlert("Correcto", $"Bienvenido {usuario.Nombre}", "OK"); await Navigation.PushAsync(new PaginaBienvenido(usuario)); } else { await DisplayAlert("Error", "Persona no identificada", "OK"); } } else { await DisplayAlert("Error", "No se pudo tomar la fotografía.", "OK"); } } catch (Exception ex) { } finally { Loading(false); } }
public EmpleadoDetalleVM(Empleado empleado) { bbdd = new ServicioBaseDatos(); if (empleado.IDEMPLEADO == 0) { FORMULARIO = new Empleado(); ACCION = Modo.Insertar; } else { //FORMULARIO = new Empleado(empleado); SELECCIONADA = new Empleado(empleado); FORMULARIO = new Empleado(SELECCIONADA); ACCION = Modo.Actualizar; } // Obtener valores para los combobox ObtenerDatosCombo(); }
async void btnRegistrar_Clicked(object sender, EventArgs e) { var bd = new ServicioBaseDatos(); bool op = (tarea.Id > 0) ? await bd.ActualizarTarea(tarea) : await bd.AgregarTarea(tarea); if (op) { await DisplayAlert("Éxito", "Operación realizada con éxito", "OK"); await Navigation.PopAsync(true); } else { await DisplayAlert("Error", "Tarea no registrada", "OK"); } }
public PedidoDetalleVM(Pedido pedido) { try { bbdd = new ServicioBaseDatos(); if (pedido.IDPEDIDO == 0) { FORMULARIO = new Pedido(); ACCION = Modo.Insertar; } else { FORMULARIO = new Pedido(pedido); SELECCIONADA = new Pedido(pedido); ACCION = Modo.Actualizar; } // Obtener valores para los combobox ObtenerDatosCombo(); } catch (Exception ex) { throw new MisExcepciones(ex.Message); } }
public ProductoDetalleVM(Producto producto) { try { bbdd = new ServicioBaseDatos(); if (producto.DESCRIPCION == null) { FORMULARIO = new Producto(); ACCION = Modo.Insertar; } else { FORMULARIO = new Producto(producto); SELECCIONADA = new Producto(producto); ACCION = Modo.Actualizar; } // Obtener valores para los combobox ObtenerDatosCombo(); } catch (Exception ex) { throw new MisExcepciones(ex.Message); } }
public EmpleadosVM() { bbdd = new ServicioBaseDatos(); EMPLEADOS = bbdd.ObtenerEmpleados(false, 0); FORMULARIO = new Empleado(); }
public CambioPasswdVM() { bbdd = new ServicioBaseDatos(); }
public LoginVM() { bbdd = new ServicioBaseDatos(); USUARIOSELECCIONADO = new Usuario(); }
public AyudaVM(string Codigo) { bbdd = new ServicioBaseDatos(); CODIGO = Codigo; FORMULARIO = bbdd.LeerAyuda(CODIGO); }
public MainWindowVM() { bbdd = new ServicioBaseDatos(); }
public ProductosVM() { bbdd = new ServicioBaseDatos(); PRODUCTOS = bbdd.ObtenerProductos(false, false); FORMULARIO = new Producto(); }