public void StartCalculation(string statisticsFileName)
        {
            StatisticsCommand command = this.resolver.Create <StatisticsCommand>();

            command.Parameters.File = statisticsFileName;
            GeneratorProcess.StartHidden(command);
        }
 public StatisticsViewModel(int userId, ParkingManager pk)
 {
     _pk            = pk;
     _userId        = userId;
     RefreshPercent = new StatisticsCommand(new Action(RefreshPercentMethod));
     RefreshPercentMethod();
 }
        /// <summary>
        /// Executes the POP3 STAT command.
        /// </summary>
        /// <returns>A Stat object containing the results of STAT command.</returns>
        /// <exception cref="Pop3Exception">If the STAT command was unable to be executed successfully.</exception>
        public StatisticsResult GetStatistics()
        {
            StatResponse response;

            using (StatisticsCommand command = new StatisticsCommand(_clientStream))
            {
                response = ExecuteCommand <StatResponse, StatisticsCommand>(command);
            }

            return(new StatisticsResult(response.MessageCount, response.Octets));
        }
        public static StatisticsCommandResponse Execute(string id)
        {
            var accountId = Guid.Parse(id);
            var skipMatch = new List <SkipMatch>();
            var skip      = DbHelper.GetSkip(accountId).GroupBy(g => g.id_turnament).ToList();

            skip.ForEach(x =>
            {
                var players = new List <Player>();
                x.ToList().ForEach(p =>
                {
                    var player = DbHelper.GetPlayer(p.id_player);
                    players.Add(new Player
                    {
                        Number     = player.number,
                        Name       = player.name,
                        Surname    = player.surname,
                        MiddleName = player.middleName,
                    });
                });

                skipMatch.Add(new SkipMatch
                {
                    TurnamentName = DbHelper.GetTurnamentName(x.Key),
                    Players       = players
                });
            });

            var game        = DbHelper.GetGameForCommand(accountId);
            var countGame   = game.Count;
            var scoreGoals  = DbHelper.GetScoreGoals(accountId);
            var missedGoals = DbHelper.GetMissedGoals(accountId);
            var victory     = game.Where(x => (x.id_command_one == accountId && x.command_one_points > x.command_two_points) || (x.id_command_two == accountId && x.command_two_points > x.command_one_points)).ToList().Count;
            var loss        = game.Where(x => (x.id_command_one == accountId && x.command_one_points < x.command_two_points) || (x.id_command_two == accountId && x.command_two_points < x.command_one_points)).ToList().Count;
            var draw        = game.Where(x => (x.id_command_one == accountId && x.command_one_points == x.command_two_points) || (x.id_command_two == accountId && x.command_two_points == x.command_one_points)).ToList().Count;

            var statisticsCommand = new StatisticsCommand
            {
                SkipMatchs  = skipMatch,
                CountGame   = countGame,
                ScoreGoals  = scoreGoals,
                MissedGoals = missedGoals,
                Victory     = victory,
                Loss        = loss,
                Draw        = draw
            };

            return(new StatisticsCommandResponse {
                StatisticsCommand = statisticsCommand
            });
        }
 public StatisticsVM()
 {
     try
     {
         StatisticsM = new StatisticsModel();
         Command     = new StatisticsCommand(this);
         Recipes     = new ObservableCollection <Recipe>(StatisticsM.GetAllRecipes());
         Patients    = new ObservableCollection <string>(StatisticsM.GetAllPatientsId());
         Medicines   = new ObservableCollection <string>(StatisticsM.GetAllMedicinesNames());
     }
     catch (Exception e)
     {
         (App.Current as App).navigation.MainWindows.comments.Text = e.Message.ToString();
     }
 }
Exemple #6
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "StatisticsGet/{idCourse:int}")] HttpRequest req,
            int idCourse)
        {
            var command = new StatisticsCommand {
                IdCourse = idCourse
            };
            var response = await _mediator.Send(command);

            var json = JsonConvert.SerializeObject(new
            {
                statistics = response
            });

            return(new OkObjectResult(json));
        }
Exemple #7
0
        static void Main(string[] args)
        {
            Section   cap1 = new Section("Capitolul 1");
            Paragraph p1   = new Paragraph("Paragraph 1");

            cap1.add(p1);
            Paragraph p2 = new Paragraph("Paragraph 2");

            cap1.add(p2);
            Paragraph p3 = new Paragraph("Paragraph 3");

            cap1.add(p3);
            Paragraph p4 = new Paragraph("Paragraph 4");

            cap1.add(p4);
            cap1.add(new ImageProxy("ImageOne"));
            cap1.add(new Image("ImageTwo"));
            cap1.add(new Paragraph("Some text"));
            cap1.add(new Table("Table 1"));

            Section   cap2 = new Section("Capitolul 1");
            Paragraph p12  = new Paragraph("Paragraph 1");

            cap2.add(p12);
            Book book = new Book("Cartea mea");

            book.add(cap1);
            book.add(cap2);
            Command.Command openCommand = new OpenCommand();
            openCommand.execute();

            Command.Command statisticsCommand = new StatisticsCommand();
            statisticsCommand.execute();

            Display display = new Display();

            cap1.accept(display);

            Console.ReadLine();
        }
Exemple #8
0
        public void NothingToSeeHere()
        {
            var wf             = _WorkflowDbProvider.CreateNew();
            var statsDbContext = _StatsDbProvider.CreateNew();
            var cmd            = new StatisticsCommand(new StatisticsDbWriter(statsDbContext, _FakeDtp),
                                                       new IStatsQueryCommand[]
            {
                new TotalWorkflowCountStatsQueryCommand(wf),
                new TotalWorkflowsWithTeksQueryCommand(wf),
                new TotalWorkflowAuthorisedCountStatsQueryCommand(wf),
                new PublishedTekCountStatsQueryCommand(wf),
                new TotalTekCountStatsQueryCommand(wf),
            });

            cmd.Execute();

            Assert.Equal(0, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == TotalWorkflowCountStatsQueryCommand.Name).Value);
            Assert.Equal(0, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == TotalWorkflowsWithTeksQueryCommand.Name).Value);
            Assert.Equal(0, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == TotalWorkflowAuthorisedCountStatsQueryCommand.Name).Value);
            Assert.Equal(0, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == PublishedTekCountStatsQueryCommand.Name).Value);
            Assert.Equal(0, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == TotalTekCountStatsQueryCommand.Name).Value);
        }
Exemple #9
0
        public void WithData()
        {
            var wf = _WorkflowDbProvider.CreateNew();

            var workflows = new[] {
                new TekReleaseWorkflowStateEntity {
                    BucketId = new byte[] { 1 }, ConfirmationKey = new byte[] { 1 }, LabConfirmationId = "1", Created = DateTime.MinValue, ValidUntil = DateTime.MinValue, Teks = new List <TekEntity>()
                },
                new TekReleaseWorkflowStateEntity {
                    BucketId = new byte[] { 2 }, ConfirmationKey = new byte[] { 2 }, LabConfirmationId = "2", Created = DateTime.MinValue, ValidUntil = DateTime.MinValue, Teks = new List <TekEntity>()
                },
                new TekReleaseWorkflowStateEntity {
                    BucketId = new byte[] { 3 }, ConfirmationKey = new byte[] { 3 }, LabConfirmationId = "3", Created = DateTime.MinValue, ValidUntil = DateTime.MinValue, Teks = new List <TekEntity>()
                },
                new TekReleaseWorkflowStateEntity {
                    BucketId = new byte[] { 4 }, ConfirmationKey = new byte[] { 4 }, LabConfirmationId = "4", Created = DateTime.MinValue, ValidUntil = DateTime.MinValue, Teks = new List <TekEntity>()
                },
                new TekReleaseWorkflowStateEntity {
                    BucketId = new byte[] { 5 }, ConfirmationKey = new byte[] { 5 }, LabConfirmationId = "5", Created = DateTime.MinValue, ValidUntil = DateTime.MinValue, Teks = new List <TekEntity>()
                },
                new TekReleaseWorkflowStateEntity {
                    BucketId = new byte[] { 6 }, ConfirmationKey = new byte[] { 6 }, LabConfirmationId = null, Created = DateTime.MinValue, ValidUntil = DateTime.MinValue, Teks = new List <TekEntity>()
                },
                new TekReleaseWorkflowStateEntity {
                    BucketId = new byte[] { 7 }, ConfirmationKey = new byte[] { 7 }, LabConfirmationId = null, Created = DateTime.MinValue, ValidUntil = DateTime.MinValue, Teks = new List <TekEntity>()
                },
                new TekReleaseWorkflowStateEntity {
                    BucketId = new byte[] { 8 }, ConfirmationKey = new byte[] { 8 }, LabConfirmationId = null, Created = DateTime.MinValue, ValidUntil = DateTime.MinValue, Teks = new List <TekEntity>()
                }
            };

            ((List <TekEntity>)workflows[0].Teks).AddRange(new [] { new TekEntity {
                                                                        KeyData = new byte[0], PublishingState = PublishingState.Published, PublishAfter = DateTime.MinValue
                                                                    } });


            ((List <TekEntity>)workflows[4].Teks).AddRange(new[]
                                                           { new TekEntity {
                                                                 KeyData = new byte[0], PublishingState = PublishingState.Published, PublishAfter = DateTime.MinValue
                                                             },
                                                             new TekEntity {
                                                                 KeyData = new byte[0], PublishingState = PublishingState.Published, PublishAfter = DateTime.MinValue
                                                             },
                                                             new TekEntity {
                                                                 KeyData = new byte[0], PublishingState = PublishingState.Published, PublishAfter = DateTime.MinValue
                                                             }, });

            ((List <TekEntity>)workflows[5].Teks).AddRange(new[]
                                                           { new TekEntity {
                                                                 KeyData = new byte[0], PublishingState = PublishingState.Unpublished, PublishAfter = DateTime.MinValue
                                                             },
                                                             new TekEntity {
                                                                 KeyData = new byte[0], PublishingState = PublishingState.Unpublished, PublishAfter = DateTime.MinValue
                                                             },
                                                             new TekEntity {
                                                                 KeyData = new byte[0], PublishingState = PublishingState.Unpublished, PublishAfter = DateTime.MinValue
                                                             },
                                                             new TekEntity {
                                                                 KeyData = new byte[0], PublishingState = PublishingState.Unpublished, PublishAfter = DateTime.MinValue
                                                             },
                                                             new TekEntity {
                                                                 KeyData = new byte[0], PublishingState = PublishingState.Unpublished, PublishAfter = DateTime.MinValue
                                                             } });

            wf.KeyReleaseWorkflowStates.AddRange(workflows);
            wf.SaveChanges();

            var statsDbContext = _StatsDbProvider.CreateNew();
            var cmd            = new StatisticsCommand(new StatisticsDbWriter(statsDbContext, _FakeDtp),
                                                       new IStatsQueryCommand[]
            {
                new TotalWorkflowCountStatsQueryCommand(wf),
                new TotalWorkflowsWithTeksQueryCommand(wf),
                new TotalWorkflowAuthorisedCountStatsQueryCommand(wf),
                new PublishedTekCountStatsQueryCommand(wf),
                new TotalTekCountStatsQueryCommand(wf),
            });

            cmd.Execute();

            Assert.Equal(8, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == TotalWorkflowCountStatsQueryCommand.Name).Value);
            Assert.Equal(3, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == TotalWorkflowsWithTeksQueryCommand.Name).Value);
            Assert.Equal(3, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == TotalWorkflowAuthorisedCountStatsQueryCommand.Name).Value);
            Assert.Equal(4, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == PublishedTekCountStatsQueryCommand.Name).Value);
            Assert.Equal(9, statsDbContext.StatisticsEntries.Single(x => x.Created.Date == _FakeDtp.Snapshot.Date && x.Name == TotalTekCountStatsQueryCommand.Name).Value);
        }
Exemple #10
0
 public async Task StatisticsEvent(TestLoggerBackend.StatisticsEventArgs args, CancellationToken cancellationToken)
 {
     LocalLogger.OnStatisticsEvent(args);
     var command = new StatisticsCommand();
     await command.Send(this, args, cancellationToken);
 }