public Analytic SaveFilters(DisplayEntities.Analytic analytic)
        {
            var payload = analytic.ToPayload();

            payload.FilterGroups = analytic.FilterGroups;
            var      session  = CreateRequest(payload);
            var      response = _analyticService.SaveFilters(session);
            Analytic data     = null;

            if (response.SessionOk)
            {
                data           = response.Data.ToDisplayEntity();
                data.SessionOk = response.SessionOk;
            }
            else
            {
                data = new Analytic
                {
                    SessionOk     = response.SessionOk,
                    ClientMessage = response.ClientMessage,
                    ServerMessage = response.ServerMessage,
                };
            }
            return(data);
        }
示例#2
0
        private void InitializeCommands()
        {
            ActionCommand = ReactiveCommand.Create();
            ActionCommand.Subscribe(x => ActionCommandExecuted(x));

            LoadAnalyticCommand = ReactiveCommand.CreateAsyncTask(async _ =>
                                                                  await Task.Run(() =>
            {
                var id = new DTO.Analytic(SelectedEntity.Id);
                var a  = ((APLPX.UI.WPF.Data.MockAnalyticService)_analyticService).LoadAnalytic(new DTO.Session <DTO.Analytic>()
                {
                    Data = id
                });
                SelectedAnalytic = a.Data.ToDisplayEntity();
            }));

            SaveAnalyticIdentityCommand = ReactiveCommand.CreateAsyncTask(async _ =>
                                                                          await Task.Run(() =>
            {
                var session = new DTO.Session <DTO.Analytic>()
                {
                    Data = SelectedAnalytic.ToDto()
                };
                var status = _analyticService.SaveIdentity(session);
            }));

            SaveFiltersCommand = ReactiveCommand.CreateAsyncTask(async _ =>
                                                                 await Task.Run(() =>
            {
                var session = new DTO.Session <DTO.Analytic>()
                {
                    Data = SelectedAnalytic.ToDto()
                };
                var status = _analyticService.SaveFilters(session);
            }));

            SavePriceListsCommand = ReactiveCommand.CreateAsyncTask(async _ =>
                                                                    await Task.Run(() =>
            {
                var session = new DTO.Session <DTO.Analytic>()
                {
                    Data = SelectedAnalytic.ToDto()
                };
                var status = _analyticService.SavePriceLists(session);
            }));

            SaveValueDriversCommand = ReactiveCommand.CreateAsyncTask(async _ =>
                                                                      await Task.Run(() =>
            {
                var session = new DTO.Session <DTO.Analytic>()
                {
                    Data = SelectedAnalytic.ToDto()
                };
                var status = _analyticService.SaveDrivers(session);
            }));
        }