public CrearAlerta(DateTime dtmFechaCreacion) { InitializeComponent(); //COMPRUEBO QUE ESTÉ LOGUEADO Y BUSCO LAS HUERTAS DEL USUARIO PARA BINDEAR CON EL COMBO bool isLoggedIn = App.Current.Properties.ContainsKey("IsLoggedIn") ? (bool)App.Current.Properties["IsLoggedIn"] : false; if (isLoggedIn) { String userLog = App.Current.Properties["user"].ToString(); var misHuertas = HuertaServicio.TodasLasHuertas(userLog); if (misHuertas.Count > 0) { cmbHuertas.ItemsSource = misHuertas; } } else { DisplayAlert("Mensaje", "No tiene iniciada la sesion", "Ok"); Navigation.PushAsync(new Index()); } //OBTENGO LA LISTA DE TIPOS DE ALERTA PARA BINDEAR CON EL COMBO var lstTiposAlerta = TipoAlertaServicio.todosLosTiposAlerta(); cmbTipoAlerta.ItemsSource = lstTiposAlerta; //LA FECHA DE LA ALERTA YA VIENE DE LA PANTALLA ANTERIOR (CALENDARIO) dtmFechaRec = dtmFechaCreacion; lblFecha.Text = dtmFechaRec.ToShortDateString(); }
private async void btnActualizar_Clicked(object sender, EventArgs e) { var userLog = App.Current.Properties["user"].ToString(); var ok = false; if (userLog != null) { if (_huertaId == "0") { ok = HuertaServicio.CrearHuerta(NombreHuerta.Text, DescHuerta.Text, userLog); } else { ok = HuertaServicio.ModificarHuerta(NombreHuerta.Text, DescHuerta.Text, _huertaId); } if (ok) { await DisplayAlert("Registro correcto", "Los datos se han completado correctamente", "Ok"); await Navigation.PushAsync(new MisHuertas()); } else { await DisplayAlert("Registro incorrecto", "Revise los datos ingresados", "Cancelar"); } } }
private void CargarHuertas(string userId) { var misHuertas = HuertaServicio.TodasLasHuertas(userId); if (misHuertas.Count > 0) { lstHuertas.ItemsSource = misHuertas; } }
private void CargarHuerta(string huertaID) { var objHuerta = HuertaServicio.BuscarPorId(huertaID); if (objHuerta != null) { txtHuerta.Text = objHuerta.Nombre; } }
public ABMHuerta(string huertaID) { InitializeComponent(); _huertaId = huertaID; if (_huertaId != "0") { Model.HuertaModel huertaEdit = HuertaServicio.BuscarPorId(_huertaId); if (huertaEdit != null) { NombreHuerta.Text = huertaEdit.Nombre; DescHuerta.Text = huertaEdit.Descripcion; } } btnActualizar.Clicked += btnActualizar_Clicked; }
private async void BtnBorrar_Clicked(object sender, EventArgs e) { var answer = await DisplayAlert("Confirmar la eliminacion", "Seguro quiere eliminar?", "Si", "No"); if (answer) { var ok = HuertaServicio.Eliminar(_huertaID); if (ok) { await DisplayAlert("Info!", "La huerta se ha eliminado correctamente", "Ok"); await Navigation.PushAsync(new MisHuertas()); } else { await DisplayAlert("Info!", "No se ha podido eliminar la huerrta", "Cancelar"); } } }
public MenuGraficos() { InitializeComponent(); //COMPRUEBO QUE ESTÉ LOGUEADO Y BUSCO LAS HUERTAS DEL USUARIO PARA BINDEAR CON EL COMBO bool isLoggedIn = App.Current.Properties.ContainsKey("IsLoggedIn") ? (bool)App.Current.Properties["IsLoggedIn"] : false; if (isLoggedIn) { String userLog = App.Current.Properties["user"].ToString(); var misHuertas = HuertaServicio.TodasLasHuertas(userLog); if (misHuertas.Count > 0) { cmbHuertas.ItemsSource = misHuertas; } } else { DisplayAlert("Mensaje", "No tiene iniciada la sesion", "Ok"); Navigation.PushAsync(new Index()); } }
private void MostrarHuertaSeleccionada(string huertaID) { var esHuerta = HuertaServicio.BuscarPorId(huertaID); if (esHuerta != null) { NombreHuerta.Text = esHuerta.Nombre; DescripcionHuerta.Text = esHuerta.Descripcion; if (esHuerta.ListaCultivos.Count > 0) { var cultivoTest = new Model.CultivoModel(); foreach (var item in esHuerta.ListaCultivos) { if (item != null) { item.descripcion = "% Sembrado: 20"; item.porcentaje = 0.2f;// 1.0 es el 100% // Difference in days, hours, and minutes. TimeSpan ts = DateTime.Now - item.IniciaCultivo; // Difference in days. int differenceInDays = ts.Days; if (differenceInDays > 180) { item.porcentaje = 1.0f; item.descripcion = "% Sembrado: 100"; } else { if (differenceInDays > 150) { item.porcentaje = 0.8f; item.descripcion = "% Sembrado: 80"; } else { if (differenceInDays > 90) { item.porcentaje = 0.5f; item.descripcion = "% Sembrado: 50"; } } } //if (item.IniciaCultivo.Month < 3) //{ // item.porcentaje = 0.8f; // item.descripcion = "% Sembrado: 80"; //} //else //{ // if (item.IniciaCultivo.Month < 6) // { // item.porcentaje = 0.5f; // item.descripcion = "% Sembrado: 50"; // } //} } } lstCultivos.ItemsSource = esHuerta.ListaCultivos; } } }