public void AddIncident(IncidentModel incident) { if (IncidentList.All(x => x.Id != incident.Id)) { IncidentList.Add(incident); } }
public void RemoveIncident(IncidentModel incident) { if (IncidentList.Contains(incident)) { IncidentList.Remove(incident); } }
public IncidentList GetIncidentsbyID(string IdentificationToken, string incidentID) { // Authenticate the Request from Token var incidents = new IncidentList { List = new List <Incident>() }; string mobileNumber = string.Empty; var Incidents = new List <entity.Incident>(); try { Incidents = _incidentAccess.GetAllIncidentsDataByID(incidentID); if (Incidents != null) { Incidents.ForEach(tease => { incidents.List.Add(Caster.MakeContractIncident(tease)); }); ResultsManager.AddResultInfo(incidents, ResultTypeEnum.Success, "Successed"); } } catch { ResultsManager.AddResultInfo(incidents, ResultTypeEnum.Exception, "Failed"); } return(incidents); }
public DashboardViewModel(CoreDispatcher dispatcher, Action onLogoutNavigation) { _onLogoutNavigation = onLogoutNavigation; if (DesignMode.DesignModeEnabled) { var incidentData = DataRepository.LoadIncidentData(); foreach (var incident in incidentData) { IncidentList.Add(incident); } SelectedIncident = IncidentList.First(); } _isMainViewZoom = true; _isEnrouteToIncident = false; _incidentIconManager = new IncidentManagerService(); _incidentIconManager.IncidentAdded += OnIncidentDataAdded; _incidentIconManager.IncidentRemoved += OnIncidentDataRemoved; _responderManager = new ResponderManagerService(); _incidentListViewModel = new IncidentListViewModel(); _responderListViewModel = new ResponderListViewModel(dispatcher); _responderManager.ResponderUpdated += OnResponderUpdated; _incidentListViewModel.IncidentSelected += OnIncidentIconSelected; LogoutButtonClickCommand = CommandWrapper(OnLogoutButtonClick); PowerBiClickCommand = CommandWrapper(OnPowerBiButtonClick); IncidentToggleButtonClickCommand = CommandWrapper(OnIncidentToggleButtonClick); ResponderToggleButtonClickCommand = CommandWrapper(OnResponderToggleButtonClick); }
public IncidentList GetIncidentsbyDates(string IdentificationToken, string startDate, string endDate) { // Authenticate the Request from Token var incidents = new IncidentList { List = new List <Incident>() }; DateTime vStartTime; DateTime vEndTime; string mobileNumber = string.Empty; vStartTime = Converter.ToDateTime(startDate).Date; vEndTime = Converter.ToMaxDateTime(endDate).Date.AddMinutes(1440).AddSeconds(-1); var Incidents = new List <entity.Incident>(); try { Incidents = _incidentAccess.GetAllIncidentsDataByFilter(vStartTime.Ticks.ToString(), vEndTime.Ticks.ToString()); if (Incidents != null) { Incidents.ForEach(tease => { incidents.List.Add(Caster.MakeContractIncident(tease)); }); ResultsManager.AddResultInfo(incidents, ResultTypeEnum.Success, "Successed"); } } catch { ResultsManager.AddResultInfo(incidents, ResultTypeEnum.Exception, "Failed"); } return(incidents); }
private void OnIncidentDataRemoved(object sender, IncidentChangedEventArgs args) { args.IncidentIcon.IncidentIconDetails -= OnIncidentIconSelected; _mapService.RemoveIncident(args.IncidentIcon); _incidentListViewModel.RemoveIncident(args.IncidentIcon.Incident); IncidentList.Remove(args.IncidentIcon.Incident); }
public async void NavigateToDetailsPane(object sender, IncidentSelectedEventArgs args) { // always show tickets SelectedIncident = IncidentList.FirstOrDefault(x => x.Id == args.IncidentId); _selectedIncidentIcon = await _mapService.UpdateSelectedItem(SelectedIncident); ToggleDetailsPane(args.IncidentId, args.ShowDetails, true); }
private void OnIncidentDataAdded(object sender, IncidentChangedEventArgs args) { args.IncidentIcon.IncidentIconDetails += OnIncidentIconSelected; IncidentList.Add(args.IncidentIcon.Incident); _mapService.AddElements(args.IncidentIcon, args.IncidentIcon.Incident.GeoLocation, IncidentModel.AnchorPoint); _responderManager.AddAvailableIncidents(args.IncidentIcon); _incidentListViewModel.AddIncident(args.IncidentIcon.Incident); }
public async void RemoveIncident(IncidentModel incident) { if (IncidentList.Contains(incident)) { await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { IncidentList.Remove(incident); }); } }
public async void AddIncident(IncidentModel incident) { if (IncidentList.All(x => x.Id != incident.Id)) { await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { IncidentList.Add(incident); }); } }
// Get incident list from messaging extension action command. public InvokeResponse GetIncientListFromMEAction(List <IncidentDetails> currentIncidentList) { if (currentIncidentList == null) { return(CreateInvokeResponse(new MessagingExtensionActionResponse { Task = new TaskModuleContinueResponse { Value = new TaskModuleTaskInfo { Card = CardHelper.GetNoInicidentFoundCard(), Height = 200, Width = 400, Title = "No Incident found", }, }, })); } else { var incidentList = new IncidentList(); var listOfIncident = new List <IncidentChoiceSet>(); foreach (var incident in currentIncidentList) { var incidentdetail = new IncidentChoiceSet() { title = $"Incident title: {incident.IncidentTitle}, Created by: {incident.CreatedBy}", value = incident.IncidentId }; listOfIncident.Add(incidentdetail); } incidentList.incidentList = listOfIncident.ToArray(); return(CreateInvokeResponse(new MessagingExtensionActionResponse { Task = new TaskModuleContinueResponse() { Value = new TaskModuleTaskInfo { Card = CardHelper.GetInicidentListCard(incidentList), Height = 460, Width = 600, Title = "Incident list", }, }, })); } }
// Get incident list card. public static Attachment GetInicidentListCard(IncidentList incidentList) { //Read the card json and create attachment. string[] paths = { ".", "Resources", "incidentListCard.json" }; var adaptiveCardJson = File.ReadAllText(Path.Combine(paths)); AdaptiveCardTemplate template = new AdaptiveCardTemplate(adaptiveCardJson); var cardJsonstring = template.Expand(incidentList); var adaptiveCardAttachment = new Attachment() { ContentType = AdaptiveCard.ContentType, Content = JsonConvert.DeserializeObject(cardJsonstring) }; return(adaptiveCardAttachment); }
private async void OnIncidentIconSelected(object sender, IncidentSelectedEventArgs e) { if (_isMainViewZoom) { SelectedIncident = e.ShowDetails ? IncidentList.FirstOrDefault(x => x.Id == e.IncidentId) : null; if (SelectedIncident != null) { _selectedIncidentIcon = await _mapService.UpdateSelectedItem(SelectedIncident); _selectedIncidentIcon.IncidentIconNavigate += OnEnrouteToIncident; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; SystemNavigationManager.GetForCurrentView().BackRequested += OnIncidentListBackRequested; } ToggleDetailsPane(e.IncidentId, e.ShowDetails, true); if (!_isEnrouteToIncident) { NavigateToIncident(); } } }
public IncidentList GetIncidents(string IdentificationToken) { // Authenticate the Request from Token var incidents = new IncidentList { List = new List <Incident>() }; var Incidents = new List <entity.Incident>(); try { Incidents = _incidentAccess.GetAllIncidents(); Incidents.ForEach(tease => { incidents.List.Add(Caster.MakeContractIncident(tease)); }); ResultsManager.AddResultInfo(incidents, ResultTypeEnum.Success, "Successed"); } catch { ResultsManager.AddResultInfo(incidents, ResultTypeEnum.Exception, "Failed"); } return(incidents); }