private void ButtonForm_Clicked(object sender, EventArgs e) { Incident LIncident = new Incident(); FDataHora = dtpDateHour.Date; FDataHora = FDataHora.Add(FHour); LIncident.CreateIncident(FCurrentCategory, App.CurrentUser, FDescription, FDataHora, LPosX, LPosY); // async Task<ICollection<IncidentCategory>> IncidentForm() // { try { string url = "https://tmappwebapi20180922043720.azurewebsites.net/api/Incident"; var json = JsonConvert.SerializeObject(LIncident); var content = new StringContent(json, Encoding.UTF8, "application/json"); var result = FCliente.PostAsync(url, content); result.Wait(); DisplayAlert("Aviso", "Ocorrência adicionada com sucesso!", "OK"); Application.Current.MainPage.Navigation.PopAsync(); IncidentFilter LFilter = new IncidentFilter(); Application.Current.MainPage.Navigation.PushAsync(new MapPage(LFilter)); Navigation.PopModalAsync(); } catch (Exception ex) { throw ex; } return; // } }
private void ButtonBuscar_Clicked(object sender, EventArgs e) { //FEndereco = String.Format(FRua + " " + FCidade); IncidentFilter LFilter = new IncidentFilter(); Navigation.PushAsync(new MapPage(LFilter)); }
async void OnLoginButtonClicked(object sender, EventArgs e) { var user = new User { EMail = usernameEntry.Text, Password = passwordEntry.Text }; pb_ProgressBar.Progress = 0; pb_ProgressBar.IsVisible = true; await pb_ProgressBar.ProgressTo(0.3, 250, Easing.SinIn); var isValid = CheckCredentials(user); await pb_ProgressBar.ProgressTo(1, 250, Easing.SinIn); if (isValid) { App.IsUserLoggedIn = true; IncidentFilter LFilter = new IncidentFilter(); //await Application.Current.MainPage.Navigation.PushAsync(new MapPage(LFilter)); Navigation.InsertPageBefore(new MapPage(LFilter), this); //var MapPage = new MapPage(LFilter); //Application.Current.MainPage = MapPage; await Application.Current.MainPage.Navigation.PopAsync(); } else { messageLabel.Text = "Login failed"; passwordEntry.Text = string.Empty; } }
public void ButtonForm_Clicked(object sender, EventArgs e) { //Substitui os valores da classe pelos valores dos campos FDescription = xDescription.Text; FIncident.Description = FDescription; FDataHora = FDataHora.Date; FDataHora.Add(FHour); FIncident.DataHora = FDataHora; FIncident.IdCategory = FCurrentCategory.IdCategory; FIncident.Category = FCurrentCategory; try { HttpClient FCliente = new HttpClient(); string url = "https://tmappwebapi20180922043720.azurewebsites.net/api/IncidentEdit"; var json = JsonConvert.SerializeObject(FIncident); var content = new StringContent(json, Encoding.UTF8, "application/json"); var result = FCliente.PostAsync(url, content); result.Wait(); DisplayAlert("Aviso", "Ocorrência alterada com sucesso!", "OK"); Application.Current.MainPage.Navigation.PopAsync(); IncidentFilter LFilter = new IncidentFilter(); Application.Current.MainPage.Navigation.PushAsync(new MapPage(LFilter)); Navigation.PopModalAsync(); } catch (Exception ex) { throw ex; } }
public ICollection <Incident> GetFilteredIncidents(IncidentFilter AFilters) { HttpClient FCliente = new HttpClient(); try { var teste = JsonConvert.DeserializeObject <DateTime>(AFilters.DateStart); string url = "https://tmappwebapi20180922043720.azurewebsites.net/api/FilteredIncident"; var json = JsonConvert.SerializeObject(AFilters); var content = new StringContent(json, Encoding.UTF8, "application/json"); var result = FCliente.PostAsync(url, content); result.Wait(); var res = result.Result.Content.ReadAsStringAsync(); if (res.Result != null) { res.Wait(); var LIncidents = JsonConvert.DeserializeObject <ICollection <Incident> >(res.Result); res.Dispose(); FCliente.Dispose(); return(LIncidents); } else { IEnumerable <Incident> LIncident = Enumerable.Empty <Incident>(); return(LIncident.ToList()); } //return LIncidents; } catch (Exception ex) { throw ex; } }
async void OnConsultaButtonClicked(object seder, EventArgs e) { IncidentFilter LFilter = new IncidentFilter(); Navigation.InsertPageBefore(new MapPage(LFilter), this); await Application.Current.MainPage.Navigation.PopAsync(); }
void FilterButton_Clicked(object sender, EventArgs e) { IncidentFilter LFilter = new IncidentFilter(); if (SelectedCategory == null) { LFilter.IdCategory = null; } else { LFilter.IdCategory = SelectedCategory.IdCategory; } if (DateSelected == true) { LFilter.DateStart = JsonConvert.SerializeObject(FDateStart.Value); } else { LFilter.DateStart = null; } DisplayAlert("Aviso", "Filtro Aplicado!", "OK"); Application.Current.MainPage.Navigation.PopAsync(); Application.Current.MainPage.Navigation.PushAsync(new MapPage(LFilter)); Navigation.PopModalAsync(); }
public IActionResult Incidents(IncidentFilter filter) { IncidentsModel model = new IncidentsModel(); model.Filter = filter; model.Incidents = _context.Incidents .Where(x => (String.IsNullOrWhiteSpace(filter.VIN) || x.Vehicle.VIN.StartsWith(filter.VIN.ToUpper())) && x.DateAndTime >= (filter.FromDate.HasValue ? filter.FromDate : DateTime.MinValue) && x.DateAndTime <= (filter.ToDate.HasValue ? filter.ToDate : DateTime.MaxValue)) .Include(i => i.Vehicle).ToList(); return(View(model)); }
public MapPage(IncidentFilter AFilter) { InitializeComponent(); //Task FTask; List <Position> FCoordinates; FCoordinates = FindCoordinates(""); Position LPosition = FCoordinates.First(); FStartingCoordinate = LPosition; map.MoveToRegion(MapSpan.FromCenterAndRadius(LPosition, Distance.FromMiles(0.2))); map.Pins.Clear(); LoadIncidents(AFilter); #region MapEvents //Evento chamado toda vez que o mapa for clicado map.MapClicked += (sender, e) => { var LLat = e.Point.Latitude; var LLong = e.Point.Longitude; Position LPos = new Position(e.Point.Latitude, e.Point.Longitude); AddIncident(LPos); }; //Evento quando o pin for clicado map.PinClicked += (sender, e) => { if (e.Pin != null) { var LIncidentModal = new IncidentModal(e.Pin.Tag); //new IncidentModal(e.Pin.Tag); Navigation.PushModalAsync(LIncidentModal); //FTask = Navigation.PushModalAsync(LIncidentModal); //FTask.Dispose(); } }; #endregion }
public void LoadIncidents(IncidentFilter AFilters) { ICollection <Incident> LReqIncidents; if (AFilters.IdCategory.HasValue || AFilters.DateStart != null) { LReqIncidents = GetFilteredIncidents(AFilters); } else { LReqIncidents = GetIncidents(); } if (LReqIncidents != null) { if (LReqIncidents.Count > 0) { foreach (var Incident in LReqIncidents) { var LCategory = GetCategoryById(Incident.IdCategory); Incident.Category = LCategory; Pin newPin = new Pin() { Type = PinType.Place, Label = Incident.Description, Address = Incident.City, Icon = PinImageDispatcher((int)Incident.Category.IncidentType), Position = new Position(Incident.PosX, Incident.PosY) }; newPin.Tag = Incident; map.Pins.Add(newPin); } } } }
public void ButtonDelete_Clicked(object sender, EventArgs e) { HttpClient FCliente = new HttpClient(); try { string url = "https://tmappwebapi20180922043720.azurewebsites.net/api/IncidentDelete"; var json = JsonConvert.SerializeObject(LIncident.IdIncident); var content = new StringContent(json, Encoding.UTF8, "application/json"); var res = FCliente.PostAsync(url, content); res.Wait(); Application.Current.MainPage.Navigation.PopAsync(); IncidentFilter LFilter = new IncidentFilter(); Application.Current.MainPage.Navigation.PushAsync(new MapPage(LFilter)); Navigation.PopModalAsync(); } catch (Exception ex) { throw ex; } }