Exemplo n.º 1
0
        public async void AddDataPointDialog_OnDialogClose()
        {
            int.TryParse(QuestId, out var qId);
            MapMarkers = new List <Marker>();

            if (qId != 0)
            {
                var quest = await QuestDataService.GetQuestDetails(qId);

                DataPoints = quest.DataPoints;
                foreach (var dataPoint in DataPoints)
                {
                    MapMarkers.Add(
                        new Marker
                    {
                        Description  = $"{dataPoint.Description}",
                        ShowPopup    = false,
                        X            = dataPoint.Longitude,
                        Y            = dataPoint.Latitude,
                        IsNegative   = dataPoint.IsNegative,
                        RadiusMeters = dataPoint.RadiusMeters,
                        Certainty    = dataPoint.Certainty
                    });
                }
            }
            StateHasChanged();
        }
Exemplo n.º 2
0
        protected override async Task OnInitializedAsync()
        {
            Saved = false;
            int.TryParse(QuestId, out var questId);
            int.TryParse(ViewId, out var viewId);

            Quests = (await QuestDataService.GetAllQuests()).ToList();
            if (questId != 0)
            {
                IsEdit  = true;
                QuestId = questId.ToString();
            }

            if (viewId == 0) //new quest is being created
            {
                //add some defaults
                View = new ViewForUpdateDto
                {
                    IsPrivate = false,
                    Age       = -1
                };
            }
            else
            {
                ViewDto = await ViewDataService.GetViewById(questId, viewId, true);

                View  = Mapper.Map <ViewForUpdateDto>(ViewDto);
                Title = $"Details for {View.Description}";
            }
            if (questId == 0 && Quests?.Count > 0)
            {
                QuestId = Quests[0].Id.ToString();
            }
        }
Exemplo n.º 3
0
        protected override async Task OnInitializedAsync()
        {
            Saved = false;
            int.TryParse(QuestId, out var questId);

            if (questId == 0) //new quest is being created
            {
                //add some defaults
                Quest = new QuestForUpdateDto
                {
                    IsPrivate = false,
                    ZoneId    = 1
                };
            }
            else
            {
                QuestDp = await QuestDataService.GetQuestDetails(questId);

                DataPoints = QuestDp.DataPoints;

                Quest            = Mapper.Map <QuestForUpdateDto>(QuestDp);
                Quest.DataPoints = Mapper.Map <IEnumerable <DataPointForCreationDto> >(QuestDp.DataPoints).ToList();
                Title            = $"Details for {Quest.Description}";
                Views            = new List <ViewDto>(await ViewDataService.GetAllViews(questId));
            }


            Zones  = (await ZoneDataService.GetAllZones()).ToList();
            ZoneId = Quest.ZoneId.ToString();
        }
Exemplo n.º 4
0
        protected override async Task OnInitializedAsync()
        {
            Saved = false;
            int.TryParse(QuestId, out var questId);
            int.TryParse(DataPointId, out var dataPointId);

            Quests = (await QuestDataService.GetAllQuests()).ToList();

            if (questId == 0 || dataPointId == 0) //new quest is being created
            {
                //add some defaults
                DataPoint = new DataPointForUpdateDto
                {
                    IsPrivate  = false,
                    IsNegative = false,
                    TimeStamp  = DateTimeOffset.Now
                };
            }
            else
            {
                DataPointDto = await DataPointDataService.GetDataPointForQuest(questId, dataPointId);

                QuestId   = DataPointDto.QuestId.ToString();
                DataPoint = Mapper.Map <DataPointForUpdateDto>(DataPointDto);
                Title     = $"Details for {DataPoint.Description}";
            }
        }
Exemplo n.º 5
0
        protected override async Task OnInitializedAsync()
        {
            int.TryParse(QuestId, out var questId);

            Quest = await QuestDataService.GetQuestDetails(questId);

            Views = new List <ViewDto>(await ViewDataService.GetAllViews(questId));
        }
Exemplo n.º 6
0
        protected async Task DeleteQuest()
        {
            int.TryParse(QuestId, out var questId);

            await QuestDataService.DeleteQuest(questId);

            StatusClass = "alert-success";
            Message     = "Deleted successfully";

            Saved = true;
        }
Exemplo n.º 7
0
        protected override async Task OnInitializedAsync()
        {
            Saved = false;
            int.TryParse(QuestId, out var questId);
            MapMarkers = new List <Marker>();

            if (questId == 0) //new quest is being created
            {
                //add some defaults
                Quest = new QuestForUpdateDto
                {
                    IsPrivate = false,
                    ZoneId    = -1
                };
            }
            else
            {
                QuestDp = await QuestDataService.GetQuestDetails(questId);

                DataPoints = QuestDp.DataPoints;

                Quest            = Mapper.Map <QuestForUpdateDto>(QuestDp);
                Quest.DataPoints = Mapper.Map <IEnumerable <DataPointForCreationDto> >(QuestDp.DataPoints).ToList();
                Title            = $"Details for {Quest.Description}";
                Views            = new List <ViewDto>(await ViewDataService.GetAllViews(questId));
                foreach (var dataPoint in Quest.DataPoints)
                {
                    MapMarkers.Add(
                        new Marker
                    {
                        Description  = $"{dataPoint.Description}",
                        ShowPopup    = false,
                        X            = dataPoint.Longitude,
                        Y            = dataPoint.Latitude,
                        RadiusMeters = dataPoint.RadiusMeters,
                        IsNegative   = dataPoint.IsNegative,
                        Certainty    = dataPoint.Certainty
                    });
                }
            }

            Zones  = (await ZoneDataService.GetAllZones()).ToList();
            ZoneId = Quest?.ZoneId.ToString();
        }
Exemplo n.º 8
0
        protected override async Task OnInitializedAsync()
        {
            Saved = false;
            int.TryParse(QuestId, out var questId);
            int.TryParse(DataPointId, out var dataPointId);

            Quests = (await QuestDataService.GetAllQuests()).ToList();
            if (questId != 0)
            {
                IsEdit  = true;
                QuestId = questId.ToString();
            }
            if (questId == 0 || dataPointId == 0) //new datapoint is being created
            {
                //add some defaults
                DataPoint = new DataPointForUpdateDto
                {
                    IsPrivate  = false,
                    IsNegative = false,
                    TimeStamp  = DateTimeOffset.Now
                };
                if (questId == 0 && Quests?.Count > 0)
                {
                    QuestId = Quests[0].Id.ToString();
                }
            }
            else
            {
                DataPointDto = await DataPointDataService.GetDataPointForQuest(questId, dataPointId);

                QuestId    = DataPointDto.QuestId.ToString();
                DataPoint  = Mapper.Map <DataPointForUpdateDto>(DataPointDto);
                MapMarkers = new List <Marker>
                {
                    new Marker {
                        Description  = $"{DataPoint.Description}", ShowPopup = false, X = DataPoint.Longitude, Y = DataPoint.Latitude,
                        RadiusMeters = DataPoint.RadiusMeters, IsNegative = DataPoint.IsNegative, Certainty = DataPoint.Certainty
                    }
                };
                Title = $"Details for {DataPoint.Description}";
            }
        }
Exemplo n.º 9
0
        protected override async Task OnInitializedAsync()
        {
            int.TryParse(QuestId, out var questId);

            Quest = await QuestDataService.GetQuestDetails(questId);

            Views      = new List <ViewDto>(await ViewDataService.GetAllViews(questId));
            MapMarkers = new List <Marker>();
            foreach (var dataPoint in Quest?.DataPoints)
            {
                MapMarkers.Add(
                    new Marker
                {
                    Description  = $"{dataPoint.Description}",
                    ShowPopup    = false,
                    X            = dataPoint.Longitude,
                    Y            = dataPoint.Latitude,
                    RadiusMeters = dataPoint.RadiusMeters,
                    IsNegative   = dataPoint.IsNegative,
                    Certainty    = dataPoint.Certainty
                });
            }
        }
Exemplo n.º 10
0
        protected async Task HandleValidSubmit()
        {
            int.TryParse(QuestId, out var questId);

            Quest.ZoneId = int.Parse(ZoneId);

            if (questId == 0) //new
            {
                var newQuest = Mapper.Map <QuestForCreationDto>(Quest);

                var addedQuest = await QuestDataService.AddQuest(newQuest);

                if (addedQuest != null)
                {
                    StatusClass = "alert-success";
                    Message     = "New quest added successfully.";
                    Saved       = true;
                }
                else
                {
                    StatusClass = "alert-danger";
                    Message     = "Something went wrong adding the new quest. Please try again.";
                    Saved       = true;
                }
            }
            else
            {
                var newQuest = Mapper.Map <QuestForUpdateDto>(Quest);

                await QuestDataService.UpdateQuest(newQuest, questId);

                StatusClass = "alert-success";
                Message     = "Quest updated successfully.";
                Saved       = true;
            }
        }
Exemplo n.º 11
0
 protected override async Task OnInitializedAsync()
 {
     Quests = (await QuestDataService.GetAllQuests())?.ToList();
     Zones  = (await ZoneDataService.GetAllZones())?.ToList();
 }