private async void BtnCrearAlerta_Clicked(object sender, EventArgs e) { var userLog = App.Current.Properties["user"].ToString(); if (userLog != null) { DateTime dtmFinal = new DateTime(dtmFechaRec.Year, dtmFechaRec.Month, dtmFechaRec.Day, tmpHora.Time.Hours, tmpHora.Time.Minutes, 00); HuertaModel objHuertaSelec = new HuertaModel(); objHuertaSelec = (HuertaModel)cmbHuertas.SelectedItem; String strIdHuertaSelec = objHuertaSelec.Id; TipoAlertaModel objTipoAlertaSelec = new TipoAlertaModel(); objTipoAlertaSelec = (TipoAlertaModel)cmbTipoAlerta.SelectedItem; String strIdTipoAlertaSelec = objTipoAlertaSelec.Id; var ok = AlertaServicio.CrearAlerta(userLog, strIdHuertaSelec, txtDescripcion.Text, dtmFinal, chkAvisa.IsToggled, strIdTipoAlertaSelec); if (ok) { await DisplayAlert("Registro correcto", "La alerta se ha grabado correctamente", "Ok"); await Navigation.PushAsync(new Calendario()); } else { await DisplayAlert("Registro incorrecto", "Revise los datos ingresados", "Cancelar"); } } }
private void CargarAlertas(string userLog) { lstMisAlertas = AlertaServicio.TodasLasAlertas(userLog); if (lstMisAlertas.Count > 0) { ColorearDiasConAlertas(lstMisAlertas); } }
private async void BtnEliminarAlerta_Clicked(object sender, EventArgs e) { var ok = AlertaServicio.EliminarAlerta(ID_Alerta, objAlerta.avisa); if (ok) { await DisplayAlert("Registro correcto", "La alerta se ha eliminado correctamente", "Ok"); await Navigation.PushAsync(new Calendario()); } else { await DisplayAlert("Registro incorrecto", "No se ha podido eliminar la alerta", "Cancelar"); } }
private void MostrarAlertaSeleccionada(int alertaID) { objAlerta = AlertaServicio.BuscarPorId(alertaID); if (objAlerta != null) { CargarTipoAlerta(objAlerta.tipoAlertaId); CargarHuerta(objAlerta.HuertaID); TimeSpan tspHoraAlerta = new TimeSpan(objAlerta.FechaHora.Hour, objAlerta.FechaHora.Minute, 00); dtpFechaAlerta.Date = objAlerta.FechaHora; tmpHora.Time = tspHoraAlerta; txtDescripcion.Text = objAlerta.Descripcion; chkAvisa.IsToggled = objAlerta.avisa == "S" ? true : false; } }
public VerGrafico(String IdHuertaSelec) { InitializeComponent(); var lstMisAlertas = AlertaServicio.AlertasPorHuerta(IdHuertaSelec); if (lstMisAlertas.Count > 0) { CalcularCantidadPorPrioridad(lstMisAlertas); } //Defino las entradas con las que se va a llenar el grafico var entries = new[] { new Microcharts.Entry(cantConsid) { Label = "Consid.", ValueLabel = cantConsid.ToString(), Color = SKColor.Parse("#5ac628") }, new Microcharts.Entry(cantNeces) { Label = "Neces.", ValueLabel = cantNeces.ToString(), Color = SKColor.Parse("#c6c628") }, new Microcharts.Entry(cantFund) { Label = "Fund.", ValueLabel = cantFund.ToString(), Color = SKColor.Parse("#c62828") } }; //Defino un nuevo gráfico de Barras y le asigno las entradas definidas antes var chart = new BarChart() { Entries = entries }; chart.LabelTextSize = 60; //Asigno el nuevo grafico al control ChartView this.chartView.Chart = chart; }
private async void BtnEditarAlerta_Clicked(object sender, EventArgs e) { var userLog = App.Current.Properties["user"].ToString(); if (userLog != null) { //PRIMERO ELIMINO LA ALERTA ANTERIOR var okEliminado = AlertaServicio.EliminarAlerta(objAlerta.Id, objAlerta.avisa); if (okEliminado) { DateTime dtmFinal = new DateTime(dtpFechaAlerta.Date.Year, dtpFechaAlerta.Date.Month, dtpFechaAlerta.Date.Day, tmpHora.Time.Hours, tmpHora.Time.Minutes, 00); TipoAlertaModel objTipoAlertaSelec = new TipoAlertaModel(); objTipoAlertaSelec = (TipoAlertaModel)cmbTipoAlerta.SelectedItem; String strIdTipoAlertaSelec = objTipoAlertaSelec.Id; var ok = AlertaServicio.CrearAlerta(userLog, objAlerta.HuertaID, txtDescripcion.Text, dtmFinal, chkAvisa.IsToggled, strIdTipoAlertaSelec); if (ok) { await DisplayAlert("Registro correcto", "La alerta se ha actualizado correctamente", "Ok"); await Navigation.PushAsync(new Calendario()); } else { await DisplayAlert("Registro incorrecto", "No se ha podido actualizar la alerta", "Cancelar"); } } else { await DisplayAlert("Registro incorrecto", "No se ha podido modificar la alerta original", "Cancelar"); } } }
private void CalCalendario_DateClicked(object sender, DateTimeEventArgs e) { lstAlertas.ItemsSource = null; var userLog = App.Current.Properties["user"].ToString(); DateTime fechaSeleccionada; //if (e.DateTime. == Convert.ToDateTime("00010101 00:00:00")) if (e.DateTime == default(DateTime)) { fechaSeleccionada = Convert.ToDateTime(calCalendario.SelectedDate); } else { fechaSeleccionada = e.DateTime; } var lstAlertasPorDia = AlertaServicio.AlertasPorDia(userLog, fechaSeleccionada); if (lstAlertasPorDia.Count > 0) { lstAlertas.ItemsSource = lstAlertasPorDia; } }