Exemple #1
0
        /// <summary>
        /// 车牌前缀查询
        /// </summary>
        /// <param name="paras">输入参数</param>
        /// <returns></returns>
        public static List <PlateNumberPrefixModel> Search_PlateNumberPrefix(InParams paras)
        {
            List <PlateNumberPrefixModel> iorecordlist = new List <PlateNumberPrefixModel>();
            IStatistics factory = StatisticsFactory.GetFactory();

            iorecordlist = factory.Search_PlateNumberPrefix(paras);

            BaseParkinfo park  = Common.Services.ParkingServices.QueryParkingByParkingID(paras.ParkingID);
            int          total = 0;

            //处理数据
            if (iorecordlist != null && iorecordlist.Count > 0)
            {
                total = iorecordlist.Select(u => u.Number).Sum();
                foreach (var record in iorecordlist)
                {
                    if (park != null)
                    {
                        record.ParkingName = park.PKName;
                    }
                    record.Rate = ((record.Number / (total * 1.0)) * 100).ToString("0.00") + "%";
                }
            }
            return(iorecordlist);
        }
Exemple #2
0
 public Worker(IReadBuffer readBuffer, IBlockDictionary writeBuffer, IStatistics stats, ISettings settings)
 {
     this.writeDictionary = writeBuffer;
     this.stats           = stats;
     this.settings        = settings;
     this.readBuffer      = readBuffer;
 }
Exemple #3
0
 public Text(IStatistics statisticsSubject, Form1 mainForm, DataGridView dgvCalender, DataGridView dgvOtherQueue, DataGridView dgvCarStereoQueue)
     : base(statisticsSubject, mainForm)
 {
     this.dgvCalender       = dgvCalender;
     this.dgvOtherQueue     = dgvOtherQueue;
     this.dgvCarStereoQueue = dgvCarStereoQueue;
 }
Exemple #4
0
 public LanguageFile(IModule refModuleFile, string languageFile, IOptions options, IStatistics stat)
 {
     _refModuleFile = refModuleFile;
     _languageFile = languageFile;
     _options = options;
     _stat = stat;
 }
        public void JoinedSubclassCascade()
        {
            G            g1 = new G("thing", "white", "10x10");
            F            f1 = new F("thing2", "blue");
            ISession     s  = OpenSession();
            ITransaction t  = s.BeginTransaction();

            s.Save(g1);
            s.Save(f1);
            t.Commit();
            s.Close();

            IStatistics statistics = Sfi.Statistics;

            statistics.Clear();

            s = OpenSession();
            t = s.BeginTransaction();
            IList <E> l = s.CreateQuery("from E").List <E>();

            statistics.Clear();

            s.Delete(l[0]);
            s.Delete(l[1]);
            t.Commit();
            s.Close();

            Assert.AreEqual(2, statistics.EntityDeleteCount);

            // In this case the batcher reuse the same command because have same SQL and same parametersTypes
            Assert.AreEqual(1, statistics.PrepareStatementCount);
        }
        private async Task OneToOneFetchTestAsync <TPerson, TDetails>(CancellationToken cancellationToken = default(CancellationToken)) where TPerson : Person, new() where TDetails : Details, new()
        {
            List <object> ids = await(this.CreatePersonAndDetailsAsync <TPerson, TDetails>(cancellationToken));

            IStatistics statistics = Sfi.Statistics;

            // Clear the second level cache and the statistics
            await(Sfi.EvictEntityAsync(typeof(TPerson).FullName, cancellationToken));
            await(Sfi.EvictEntityAsync(typeof(TDetails).FullName, cancellationToken));
            await(Sfi.EvictQueriesAsync(cancellationToken));

            statistics.Clear();

            // Fill the empty caches with data.
            await(this.FetchPeopleByIdAsync <TPerson>(ids, cancellationToken));

            // Verify that no data was retrieved from the cache.
            Assert.AreEqual(0, statistics.SecondLevelCacheHitCount, "Second level cache hit count");

            statistics.Clear();

            await(this.FetchPeopleByIdAsync <TPerson>(ids, cancellationToken));

            Assert.AreEqual(0, statistics.SecondLevelCacheMissCount, "Second level cache miss count");
        }
            public WcfTestClient(IStatistics statistics, TestClientSettings settings)
                : base(statistics, settings)
            {
                _stopwatch.Start();

                _service = new ServerServiceClient(
                    new NetTcpBinding
                    {
                        Security = new NetTcpSecurity
                        {
                            Mode = SecurityMode.None,
                            Transport = new TcpTransportSecurity
                            {
                                ProtectionLevel = ProtectionLevel.None
                            },
                            Message = new MessageSecurityOverTcp
                            {
                                ClientCredentialType = MessageCredentialType.None
                            }
                        }
                        // , TransferMode = TransferMode.Streamed
                    },
                    new EndpointAddress("net.tcp://" + Settings.Host + ":" + Constants.WcfPort + "/ServerService/")
                );

                _service.Open();
            }
        private ICode ExpandTargetAddressOfJumpInstructionTo4Bytes(ICode code,
                                                                   IInstructionWithAddressOperandDecider InstructionWithAddressOperandDecider,
                                                                   IInstructionWithAddressOperandTransform InstructionWithAddressOperandTransform,
                                                                   ICodeTransform codeTransform,
                                                                   IStatistics statistics)
        {
            TryTransformInstructionDelegate transformInstructionDelegate =
                (IAssemblyInstructionForTransformation instruction, IBasicBlock basicBlock, IFunction function,
                 out List <IAssemblyInstructionForTransformation> listOfTransformedInstructions) =>
            {
                listOfTransformedInstructions = null;
                var wasTransformed = false;
                //replace jump instruction to jump instructions with 4 bytes operand=
                if (InstructionWithAddressOperandDecider.IsJumpInstructionWithRelativeAddressOperand(instruction) &&
                    IsJumpInstructionToCodeSection(code, instruction))
                {
                    if (InstructionWithAddressOperandTransform.TryTransformJumpInstructionTo4BytesOperandSize(instruction,
                                                                                                              out IAssemblyInstructionForTransformation transformedInstruction))
                    {
                        wasTransformed = true;
                        listOfTransformedInstructions = new List <IAssemblyInstructionForTransformation>()
                        {
                            transformedInstruction
                        };
                        statistics.IncrementInstructionExpanded((uint)(transformedInstruction.Bytes.Length - instruction.Bytes.Length));
                    }
                }

                return(wasTransformed);
            };

            return(codeTransform.Transform(code, transformInstructionDelegate));
        }
Exemple #9
0
        public static Pagination Search_MonthCardInfo(InParams paras, int PageSize, int PageIndex)
        {
            Pagination  _pagination = new Pagination();
            IStatistics factory     = StatisticsFactory.GetFactory();

            _pagination.Total = factory.Search_MonthCardInfoCount(paras);
            List <MonthCardInfoModel> iorecordlist = factory.Search_MonthCardInfo(paras, PageSize, PageIndex);

            if (iorecordlist != null && iorecordlist.Count > 0)
            {
                foreach (var m in iorecordlist)
                {
                    if (m.StartTime > DateTime.MinValue)
                    {
                        m.strStartTime = m.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                    if (m.EndTime > DateTime.MinValue)
                    {
                        m.strEndTime = m.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                }
            }
            _pagination.MonthCardList = iorecordlist;
            return(_pagination);
        }
        public static void Print(IStatistics statistics)
        {
            var sb = new StringBuilder();
            sb.AppendLine("==================================================================================");
            sb.AppendFormat("Statistics for {0} {1}\n", statistics.Make, statistics.Model);

            sb.AppendFormat("Highest Price:      {0}\n", statistics.HighestPrice);
            sb.AppendFormat("Lowest Price:       {0}\n", statistics.LowestPrice);
            sb.AppendFormat("Mean Price:         {0}\n", Math.Round(statistics.MeanPrice, 2));
            sb.AppendFormat("Median Price:       {0}\n", statistics.MedianPrice);
            sb.AppendFormat("Mode Price:         {0}\n", statistics.ModePrice);
            sb.AppendFormat("Standard Deviation: {0}\n", Math.Round(statistics.StandardDeviation, 2));
            sb.AppendFormat("Sample Size:        {0}\n", statistics.SampleSize);

            sb.AppendFormat("Mean Price Per Year\n");
            statistics.MeanPriceByYear.ToList().ForEach(y => sb.AppendFormat("  {0}      {1, -10}    sample size: {2}\n", y.Item1, Math.Round(y.Item2, 2), y.Item3));

            sb.AppendFormat("Depreciation By Year\n");
            statistics.DepreciationByYear.ToList().ForEach(y => sb.AppendFormat("  {0}      {1, -10}    sample size: {2}\n", y.Item1, Math.Round(y.Item2, 2), y.Item3));

            sb.AppendFormat("Depreciation By Year Cumulative\n");
            statistics.DepreciationByYearCumulative.ToList().ForEach(y => sb.AppendFormat("  {0}      {1}\n", y.Item1, Math.Round(y.Item2, 2)));

            sb.AppendFormat("Outlier vehicles\n");
            statistics.OutlierVehicles.GroupBy(v => v.Vehicle.Year)
                .ToList()
                .ForEach(y => sb.AppendFormat("  {0}      {1}\n", y.Key, y.Count()));
            sb.AppendFormat("==================================================================================\n");

            Console.WriteLine(sb);
        }
        /// <summary>
        /// Initialize all statistics.
        /// </summary>
        /// <param name="userTasks">List of all tasks for given user</param>
        public StatisticsViewModel(List <UserTasksModel> userTasks)
        {
            _userTasks  = userTasks;
            _statistics = new Statistics(userTasks);

            InitializeStatistics();
        }
        private NHSessionStatistics Get(IStatistics statistics)
        {
            try
            {
                if (statistics == null)
                {
                    return(null);
                }

                var result = new NHSessionStatistics();

                result.CloseStatementCount     = statistics.CloseStatementCount;
                result.CollectionFetchCount    = statistics.CollectionFetchCount;
                result.CollectionLoadCount     = statistics.CollectionLoadCount;
                result.CollectionRecreateCount = statistics.CollectionRecreateCount;
                result.CollectionRemoveCount   = statistics.CollectionRemoveCount;

                result.CollectionRoleNames              = statistics.CollectionRoleNames;
                result.EntityNames                      = statistics.EntityNames;
                result.Queries                          = statistics.Queries;
                result.SecondLevelCacheRegionNames      = statistics.SecondLevelCacheRegionNames;
                result.QueryExecutionMaxTimeQueryString = statistics.QueryExecutionMaxTimeQueryString;

                result.CollectionUpdateCount      = statistics.CollectionUpdateCount;
                result.ConnectCount               = statistics.ConnectCount;
                result.EntityDeleteCount          = statistics.EntityDeleteCount;
                result.EntityFetchCount           = statistics.EntityFetchCount;
                result.EntityInsertCount          = statistics.EntityInsertCount;
                result.EntityLoadCount            = statistics.EntityLoadCount;
                result.EntityUpdateCount          = statistics.EntityUpdateCount;
                result.FlushCount                 = statistics.FlushCount;
                result.OperationThreshold         = statistics.OperationThreshold;
                result.OptimisticFailureCount     = statistics.OptimisticFailureCount;
                result.PrepareStatementCount      = statistics.PrepareStatementCount;
                result.QueryCacheHitCount         = statistics.QueryCacheHitCount;
                result.QueryCacheMissCount        = statistics.QueryCacheMissCount;
                result.QueryCachePutCount         = statistics.QueryCachePutCount;
                result.QueryExecutionCount        = statistics.QueryExecutionCount;
                result.QueryExecutionMaxTime      = statistics.QueryExecutionMaxTime;
                result.SecondLevelCacheHitCount   = statistics.SecondLevelCacheHitCount;
                result.SecondLevelCacheMissCount  = statistics.SecondLevelCacheMissCount;
                result.SecondLevelCachePutCount   = statistics.SecondLevelCachePutCount;
                result.SessionCloseCount          = statistics.SessionCloseCount;
                result.SessionOpenCount           = statistics.SessionOpenCount;
                result.SuccessfulTransactionCount = statistics.SuccessfulTransactionCount;
                result.TransactionCount           = statistics.TransactionCount;

                return(result);
            }
            catch (Exception e)
            {
                _genericLog.Error($"{_nameOfThis} - Exception while Getting Statistics: {e.Message}");
                _genericLog.Debug($"{_nameOfThis} - Exception while Getting Statistics: {e.StackTrace}");
                if (!ContinueOnError)
                {
                    throw;
                }
                return(null);
            }
        }
Exemple #13
0
 public OverworldPlayer(IRMap map, IStatistics statistics)
 {
     _map        = map;
     _statistics = statistics;
     _fovMap     = _map.Subscribe();
     _viewRadius = 10;
 }
Exemple #14
0
        public ResourceVerifierBlock(CancellationToken cancellationToken, IStatistics statistics, IResourceVerifier resourceVerifier,
                                     ILog log) : base(cancellationToken, maxDegreeOfParallelism: 300)
        {
            _log               = log;
            _statistics        = statistics;
            _resourceVerifier  = resourceVerifier;
            _cancellationToken = cancellationToken;

            var generalDataflowBlockOptions = new DataflowBlockOptions {
                CancellationToken = cancellationToken
            };

            VerificationResults     = new BufferBlock <VerificationResult>(generalDataflowBlockOptions);
            FailedProcessingResults = new BufferBlock <FailedProcessingResult>(generalDataflowBlockOptions);
            Events = new BufferBlock <Event>(new DataflowBlockOptions {
                EnsureOrdered = true, CancellationToken = cancellationToken
            });

            base.Completion.ContinueWith(_ =>
            {
                Events.Complete();
                VerificationResults.Complete();
                FailedProcessingResults.Complete();
            });
        }
Exemple #15
0
        public void POST(IStatistics statsToSave)
        {
            try
            {
                string webAddr = "http://localhost:56233/api/Match";

                var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
                httpWebRequest.ContentType = "application/json; charset=utf-8";
                httpWebRequest.Method      = "POST";

                using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
                {
                    //string json = "{\n" + "\"teamOne\": " + "\"" + statsToSave.getName1().ToString() + "\",\n" + "\"teamTwo\": " + "\"" + statsToSave.getName2().ToString() + "\",\n" + "\"scoreOne\": " + "\"" + statsToSave.getScore1() + "\",\n" + "\"scoreTwo\": " + "\"" + statsToSave.getScore2() + "\",\n" + "\"date\": " + "\"" + statsToSave.GetDate().ToString() + "\",\n" + "}";
                    string json = JsonConvert.SerializeObject(statsToSave);
                    streamWriter.Write(json);
                    streamWriter.Flush();
                }
                var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    var responseText = streamReader.ReadToEnd();
                    Console.WriteLine(responseText);
                }
            }
            catch (WebException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 public JsonDocumentEncoder(IStatistics statistics)
 {
     this.statistics = statistics;
     serializerSettings = new JsonSerializerSettings();
     serializerSettings.Converters.Add(new StringEnumConverter());
     serializerSettings.Formatting = Formatting.Indented;
 }
Exemple #17
0
 public ExamsController(IExamRepository examRepository, IAnswerRepository answerRepository, IStatistics statistics, AppConfig config)
 {
     this.examRepository   = examRepository;
     this.answerRepository = answerRepository;
     this.config           = config;
     this.statistics       = statistics;
 }
        public void TestInitialise()
        {
            _OriginalClassFactory = Factory.TakeSnapshot();

            _HeartbeatService = TestUtilities.CreateMockSingleton<IHeartbeatService>();
            _StandingDataManager = TestUtilities.CreateMockSingleton<IStandingDataManager>();
            _StandingDataManager.Setup(r => r.FindCodeBlock(It.IsAny<string>())).Returns(new CodeBlock() { Country = "X" });
            _StandingDataManager.Setup(r => r.CodeBlocksLoaded).Returns(true);

            _Statistics = Factory.Singleton.Resolve<IStatistics>().Singleton;
            _Statistics.Initialise();
            _Statistics.ResetConnectionStatistics();
            _Statistics.ResetMessageCounters();

            _Translator = Factory.Singleton.Resolve<IRawMessageTranslator>();
            _Provider = new Mock<IRawMessageTranslatorProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties();
            _Provider.Setup(r => r.UtcNow).Returns(new DateTime(1999, 12, 31));
            _Translator.Provider = _Provider.Object;

            _PositionResetEvent = new EventRecorder<EventArgs<string>>();
            _Translator.PositionReset += _PositionResetEvent.Handler;

            _NowUtc = new DateTime(2012, 1, 2, 3, 4, 5, 6);
            _ModeSMessage = new ModeSMessage() { DownlinkFormat = DownlinkFormat.AllCallReply, Icao24 = 0x112233, ParityInterrogatorIdentifier = 0 };
            _AdsbMessage = new AdsbMessage(_ModeSMessage);

            _RandomIcaos = new List<int>();
        }
Exemple #19
0
 public Logic(IWebServiceCall wsc, IStatistics stat, IBallTracker ballTrack, IGateTracker gateTrack)
 {
     _wsc        = wsc;
     _statistics = stat;
     _ballTrack  = ballTrack;
     _gateTrack  = gateTrack;
 }
Exemple #20
0
        private List <NHEntityStatistics> Get(IStatistics statistics)
        {
            var result = new List <NHEntityStatistics>();

            try
            {
                var entityNames = _configuration?.Entities?.MonitoredEntities;
                if (entityNames == null || !entityNames.Any())
                {
                    entityNames =
                        statistics.EntityNames
                        .Union(statistics.CollectionRoleNames).ToList();
                }

                foreach (var entityName in entityNames)
                {
                    result.Add(Get(statistics, entityName));
                }
            }
            catch (Exception e)
            {
                _log.Error($"{_nameOfThis} - Failed to Get Statistics for {_nameOfThis}: {e.Message}");
                _log.Debug($"{_nameOfThis} - Failed to Get Statistics for {_nameOfThis}: {e.StackTrace}");
                if (!ContinueOnError)
                {
                    throw;
                }
            }
            return(result.Where(_where).ToList());
        }
Exemple #21
0
        public void Capture(IStatistics statistics, MonitorStatus status)
        {
            try
            {
                switch (status)
                {
                case MonitorStatus.None:
                    break;

                case MonitorStatus.Stopped:
                    _currentStatistics = Get(statistics);
                    break;

                case MonitorStatus.Running:
                    _previousStatistics = Get(statistics);
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                _log.Error($"{_nameOfThis} - Failed to Capture Statistics for {_nameOfThis}: {e.Message}");
                _log.Debug($"{_nameOfThis} - Failed to Capture Statistics for {_nameOfThis}: {e.StackTrace}");
                if (!ContinueOnError)
                {
                    throw;
                }
            }
        }
Exemple #22
0
        public Strategy(IStatistics st)
        {
            ema     = new EMA();
            bands   = st.Base > 1 && st.Sigma > 0 && st.Percent > 0 && st.Max > 0 ? true : false;
            days    = st.ShortDayPeriod > 1 && st.LongDayPeriod > 2 ? true : false;
            count   = st.Quantity + 1;
            Headway = st.Time;

            if (bands)
            {
                over     = new BollingerBands(st.Sigma * 0.1, st.Base, st.Percent, st.Max);
                baseTick = new List <double>(2097152);
            }
            if (days)
            {
                shortDay = new List <double>(512);
                longDay  = new List <double>(512);
            }
            shortTick = new List <double>(2097152);
            longTick  = new List <double>(2097152);
            Send     += Analysis;
            this.st   = st;
            GetChart();
            Send          -= Analysis;
            api            = ConnectAPI.Get();
            api.SendDatum += Analysis;
            balance        = Balance.Get();
            SendLiquidate += balance.OnReceiveLiquidate;
        }
Exemple #23
0
 public LanguageFile(IModule refModuleFile, string languageFile, IOptions options, IStatistics stat)
 {
     _refModuleFile = refModuleFile;
     _languageFile  = languageFile;
     _options       = options;
     _stat          = stat;
 }
        private void OneToOneFetchTest <TPerson, TDetails>() where TPerson : Person, new() where TDetails : Details, new()
        {
            List <object> ids = this.CreatePersonAndDetails <TPerson, TDetails>();

            IStatistics statistics = Sfi.Statistics;

            // Clear the second level cache and the statistics
            Sfi.EvictEntity(typeof(TPerson).FullName);
            Sfi.EvictEntity(typeof(TDetails).FullName);
            Sfi.EvictQueries();

            statistics.Clear();

            // Fill the empty caches with data.
            this.FetchPeopleById <TPerson>(ids);

            // Verify that no data was retrieved from the cache.
            Assert.AreEqual(0, statistics.SecondLevelCacheHitCount, "Second level cache hit count");

            statistics.Clear();

            this.FetchPeopleById <TPerson>(ids);

            Assert.AreEqual(0, statistics.SecondLevelCacheMissCount, "Second level cache miss count");
        }
Exemple #25
0
        private void printStats(IConnection c)
        {
            IStatistics s = c.Stats;

            System.Console.WriteLine("Statistics:  ");
            System.Console.WriteLine("   Incoming Payload Bytes: {0}", s.InBytes);
            System.Console.WriteLine("   Incoming Messages: {0}", s.InMsgs);
        }
Exemple #26
0
        public Display(IStatistics statisticsSubject, Form1 mainForm)
        {
            this.statisticsSubject = statisticsSubject;
            this.mainForm          = mainForm;

            // IMPORTANT
            statisticsSubject.AddDisplay(this);
        }
Exemple #27
0
        public Display(IStatistics statisticsSubject, Form1 mainForm)
        {
            this.statisticsSubject = statisticsSubject;
            this.mainForm = mainForm;

            // IMPORTANT
            statisticsSubject.AddDisplay(this);
        }
Exemple #28
0
 public IndexModule(IPoolManager poolManager, IStatistics statistics)
 {
     Get["/"] = _ => View["index", new IndexModel
     {
         Pools = poolManager.Pools,
         Statistics = statistics,
     }];
 }
Exemple #29
0
        private void printStats(IConnection c)
        {
            IStatistics s = c.Stats;

            Console.WriteLine("Statistics:  ");
            Console.WriteLine("   Outgoing Payload Bytes: {0}", s.OutBytes);
            Console.WriteLine("   Outgoing Messages: {0}", s.OutMsgs);
        }
Exemple #30
0
        private void printStats(IConnection c, ILogger <HomeController> logger)
        {
            IStatistics s = c.Stats;

            logger.LogDebug("Statistics:  ");
            logger.LogDebug("   Outgoing Payload Bytes: {0}", s.OutBytes);
            logger.LogDebug("   Outgoing Messages: {0}", s.OutMsgs);
        }
Exemple #31
0
        protected TestClient(IStatistics statistics, TestClientSettings settings)
        {
            if (settings == null)
                throw new ArgumentNullException("settings");

            Statistics = statistics;
            Settings = settings;
        }
Exemple #32
0
        public SelectCourseModel(IStatistics statsRepo, ICourses repository)
        {
            statistics = statsRepo;
            courses    = repository;

            // TO CREATE A NEW SHEET EVERY TIME WE START THE PROGRAM.
            statistics.CreateSheet(new StatSheet());
        }
Exemple #33
0
        /// <summary>
        /// Adds a specified statistics into the set using its name as the key.
        /// </summary>
        /// <param name="stat"></param>
        public void AddField(IStatistics stat)
        {
            object key = StatisticsHelper.ResolveID(stat);

            _fields[key] = stat;

            stat.Context = Context;
        }
 private async Task OnStatisticsAsync(IStatistics e, CancellationToken token)
 {
     await AddMessage(ConsoleColor.DarkYellow, DateTime.UtcNow,
                      $"Id:{e.Id}\n" +
                      $"Number Of Events: {e.NumberOfEvents}\n" +
                      $"Elapsed Time: {e.ElapsedTime}",
                      token).ConfigureAwait(false);
 }
Exemple #35
0
        /// <summary>
        /// 获得临停缴费记录
        /// </summary>
        /// <param name="paras">输入参数</param>
        /// <returns></returns>
        public static List <ParkOrder> Search_TempPays(InParams paras)
        {
            IStatistics      factory = StatisticsFactory.GetFactory();
            List <ParkOrder> temp    = factory.Search_TempPays(paras);

            ParkOrderFormat(temp);
            return(temp);
        }
Exemple #36
0
        private static void ConvertStatistics(IStatistics statistics, SqlCeConnection conn)
        {
            using (SqlCeCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = "INSERT INTO History (VocabularyId, MeaningId, ActionId, SyncMod) VALUES (@VocabularyId, @MeaningId, @ActionId, @SyncMod)";
                cmd.Parameters.Add(new SqlCeParameter("VocabularyId", new Guid("ad4c2b38-80fd-4920-a727-bd6bbd24cc28")));
                cmd.Parameters.Add(new SqlCeParameter("MeaningId", SqlDbType.UniqueIdentifier));
                cmd.Parameters.Add(new SqlCeParameter("ActionId", SqlDbType.NVarChar));
                cmd.Parameters.Add(new SqlCeParameter("SyncMod", SqlDbType.DateTime));
                cmd.Prepare();

                Console.Write("modified on [{0}]...", statistics.Modified);

                DateTime mininum = new DateTime(2000, 1, 1);
                cmd.Parameters["MeaningId"].Value = statistics.Guid;
                cmd.Parameters["ActionId"].Value = "M";
                cmd.Parameters["SyncMod"].Value = statistics.Modified > mininum ? statistics.Modified : mininum;
                cmd.ExecuteNonQuery();

                Console.WriteLine("ok");

                foreach (DateTime date in statistics.EnumerateRightAnswers())
                {
                    Console.Write("answer right on [{0}]...", date);

                    cmd.Parameters["MeaningId"].Value = statistics.Guid;
                    cmd.Parameters["ActionId"].Value = "R";
                    cmd.Parameters["SyncMod"].Value = date;
                    cmd.ExecuteNonQuery();

                    Console.WriteLine("ok");
                }

                foreach (DateTime date in statistics.EnumerateWrongAnswers())
                {
                    Console.Write("answer wrong on [{0}]...", date);

                    cmd.Parameters["MeaningId"].Value = statistics.Guid;
                    cmd.Parameters["ActionId"].Value = "W";
                    cmd.Parameters["SyncMod"].Value = date;
                    cmd.ExecuteNonQuery();

                    Console.WriteLine("ok");
                }

                foreach (DateTime date in statistics.EnumeratePromptAnswers())
                {
                    Console.Write("answer prompt on [{0}]...", date);

                    cmd.Parameters["MeaningId"].Value = statistics.Guid;
                    cmd.Parameters["ActionId"].Value = "P";
                    cmd.Parameters["SyncMod"].Value = date;
                    cmd.ExecuteNonQuery();

                    Console.WriteLine("ok");
                }
            }
        }
        public void TestInitialise()
        {
            _Statistics = Factory.Singleton.Resolve<IStatistics>().Singleton;
            _Statistics.Initialise();
            _Statistics.ResetMessageCounters();

            _Translator = Factory.Singleton.Resolve<IAdsbTranslator>();
            _ModeSMessage = new ModeSMessage();
        }
        public void TestInitialise()
        {
            _Statistics = Factory.Singleton.Resolve<IStatistics>().Singleton;
            _Statistics.Initialise();
            _Statistics.ResetConnectionStatistics();
            _Statistics.ResetMessageCounters();

            _Translator = Factory.Singleton.Resolve<IModeSTranslator>();
        }
Exemple #39
0
        /// <summary>
        /// 获得临停缴费记录
        /// </summary>
        /// <param name="paras">输入参数</param>
        /// <param name="PageSize">每页显示数</param>
        /// <param name="PageIndex">当前页</param>
        /// <returns></returns>
        public static Pagination Search_CarDerates(InParams paras, int PageSize, int PageIndex)
        {
            Pagination  _pagination = new Pagination();
            IStatistics factory     = StatisticsFactory.GetFactory();

            _pagination.Total         = factory.Search_CarDeratesCount(paras);
            _pagination.CarDerateList = factory.Search_CarDerates(paras, PageSize, PageIndex);
            return(_pagination);
        }
Exemple #40
0
        /// <summary>
        /// 获得临停缴费记录
        /// </summary>
        /// <param name="paras">输入参数</param>
        /// <param name="PageSize">每页显示数</param>
        /// <param name="PageIndex">当前页</param>
        /// <returns></returns>
        public static Pagination Search_SellerRecharge(InParams paras, int PageSize, int PageIndex)
        {
            Pagination  _pagination = new Pagination();
            IStatistics factory     = StatisticsFactory.GetFactory();

            _pagination.Total     = factory.Search_SellerRechargeCount(paras);
            _pagination.OrderList = factory.Search_SellerRecharges(paras, PageSize, PageIndex);
            return(_pagination);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PreviewDictionary"/> class.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <remarks>Documented by Dev03, 2009-03-23</remarks>
 public PreviewDictionary(IUser user)
 {
     parent = new ParentClass(user, this);
     cards = new PreviewCards(parent.GetChildParentClass(this));
     userSettings = new PreviewSettings(parent.GetChildParentClass(this));
     allowedSettings = new PreviewSettings(parent.GetChildParentClass(this));
     defaultSettings = new PreviewSettings(parent.GetChildParentClass(this));
     statistics = new PreviewStatistics();
 }
Exemple #42
0
        public DocumentStore(string rootPath)
        {
            statistics = new Statistics();
            storageEngine = new StorageEngine(rootPath, statistics);

            encoders = new EncoderSelector();
            encoders.Add(new JsonDocumentEncoder(statistics));
            encoders.Add(new BlobEncoder());
        }
Exemple #43
0
        public static Pagination Search_DevConnctions(InParams paras, int PageSize, int PageIndex)
        {
            Pagination  _pagination = new Pagination();
            IStatistics factory     = StatisticsFactory.GetFactory();

            _pagination.Total         = factory.Search_DevConnectionCount(paras);
            _pagination.GateEventList = factory.Search_DevConnection(paras, PageSize, PageIndex);
            return(_pagination);
        }
 public static bool StopCondition(IStatistics stat, IGAconfiguration gaConfigs)
 {
     if (stat.CurrentIteration < gaConfigs.IterationsNumber)
     {
         return false;
     }
     else
     {
         return true;
     }
 }
        public static void PrintLoadStatistics(IStatistics statistics)
        {
            Console.WriteLine();
            Console.WriteLine("== Short Summary at: {0} ==", DateTime.Now);
            Console.WriteLine("CollectionFetchCount: {0}", statistics.CollectionFetchCount);
            Console.WriteLine("CollectionLoadCount: {0}", statistics.CollectionLoadCount);

            Console.WriteLine("EntityFetchCount: {0}", statistics.EntityFetchCount);
            Console.WriteLine("EntityLoadCount: {0}", statistics.EntityLoadCount);

            Console.WriteLine("FlushCount: {0}", statistics.FlushCount);
        }
Exemple #46
0
        /// <summary>实例化增强UDP</summary>
        public UdpServer()
        {
            SessionTimeout = 30;

            // Udp服务器不能关闭自己,但是要关闭会话
            // Udp客户端一般不关闭自己
            EnableReset = false;

            Local = new NetUri(NetType.Udp, IPAddress.Any, 0);
            Remote.Type = NetType.Udp;
            _Sessions = new SessionCollection(this);

            StatSession = new Statistics();
        }
        /// <summary>
        /// Resolves the ID of a statistics based on its context and name
        /// </summary>
        /// <param name="stat"></param>
        /// <returns></returns>
        public static object ResolveID(IStatistics stat)
        {
            object key = null;
            if (stat.Context != null)
            {
                key = String.Format("{0}.{1}", stat.Context.ID, stat.Name);
            }
            else
            {
                key = String.Format("{0}", stat.Name);
            }

            Debug.Assert(key != null);
            return key;
        }
            public ProtoChannelTestClient(IStatistics statistics, TestClientSettings settings)
                : base(statistics, settings)
            {
                _stopwatch.Start();

                _callbackService = new ClientCallbackService();

                _callbackService.StreamReceived += _callbackService_StreamReceived;

                var configuration = new ProtoClientConfiguration
                {
                    CallbackObject = _callbackService
                };

                _service = new ClientService(settings.Host, Constants.ProtoChannelPort, configuration);
            }
Exemple #49
0
        public ApiModule(IStatistics statistics)
        {
            Get["/api/"] = _ => View["api", new ApiModel
            {
                BaseUrl = Request.Url.SiteBase,
                Coin = statistics.Pools.First().Value.Config.Coin
            }];

            Get["/api/global"] = _ => Response.AsJson(statistics.Global.GetResponseObject());

            Get["/api/pools"] = _ => Response.AsJson(statistics.Pools.GetResponseObject());

            Get["/api/pool/{slug}"] = _ =>
            {
                var pool = statistics.Pools.GetBySymbol(_.slug);

                Response response;

                if (pool == null)
                    response = JsonConvert.SerializeObject(new JsonError("Pool not found!"));
                else
                    response = (Response)pool.Json;

                response.ContentType = "application/json";
                return response;
            };

            Get["/api/algorithms"] = _ => Response.AsJson(statistics.Algorithms.GetResponseObject());

            Get["/api/algorithm/{slug}"] = _ =>
            {
                var algorithm = statistics.Algorithms.GetByName(_.slug);

                Response response;

                if (algorithm == null)
                    response = JsonConvert.SerializeObject(new JsonError("Algorithm not found!"));
                else
                    response = (Response)algorithm.Json;

                response.ContentType = "application/json";
                return response;
            };
        }
        public void TestInitialise()
        {
            _Statistics = Factory.Singleton.Resolve<IStatistics>().Singleton;
            _Statistics.Initialise();
            _Statistics.ResetConnectionStatistics();
            _Statistics.ResetMessageCounters();

            _OriginalClassFactory = Factory.TakeSnapshot();

            _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>();
            _RuntimeEnvironment.Setup(r => r.IsTest).Returns(true);

            _Port30003Translator = TestUtilities.CreateMockImplementation<IBaseStationMessageTranslator>();
            _ModeSTranslator = TestUtilities.CreateMockImplementation<IModeSTranslator>();
            _AdsbTranslator = TestUtilities.CreateMockImplementation<IAdsbTranslator>();
            _RawMessageTranslator = new Mock<IRawMessageTranslator>(MockBehavior.Default) { DefaultValue = DefaultValue.Mock };
            _ModeSParity = TestUtilities.CreateMockImplementation<IModeSParity>();
            _ModeSMessage = new ModeSMessage();
            _AdsbMessage = new AdsbMessage(_ModeSMessage);
            _Port30003Message = new BaseStationMessage();
            _Port30003Translator.Setup(r => r.Translate(It.IsAny<string>())).Returns(_Port30003Message);
            _AdsbTranslator.Setup(r => r.Translate(It.IsAny<ModeSMessage>())).Returns(_AdsbMessage);
            _ModeSTranslator.Setup(r => r.Translate(It.IsAny<byte[]>())).Returns(_ModeSMessage);
            _ModeSTranslator.Setup(r => r.Translate(It.IsAny<byte[]>(), It.IsAny<int>())).Returns(_ModeSMessage);
            _RawMessageTranslator.Setup(r => r.Translate(It.IsAny<DateTime>(), It.IsAny<ModeSMessage>(), It.IsAny<AdsbMessage>())).Returns(_Port30003Message);

            _Listener = Factory.Singleton.Resolve<IListener>();
            _Provider = new MockListenerProvider();
            _BytesExtractor = new MockMessageBytesExtractor();

            _ExceptionCaughtEvent = new EventRecorder<EventArgs<Exception>>();
            _ConnectionStateChangedEvent = new EventRecorder<EventArgs>();
            _ModeSMessageReceivedEvent = new EventRecorder<ModeSMessageEventArgs>();
            _Port30003MessageReceivedEvent = new EventRecorder<BaseStationMessageEventArgs>();
            _SourceChangedEvent = new EventRecorder<EventArgs>();

            _Listener.ConnectionStateChanged += _ConnectionStateChangedEvent.Handler;
            _Listener.ExceptionCaught += _ExceptionCaughtEvent.Handler;
            _Listener.ModeSMessageReceived += _ModeSMessageReceivedEvent.Handler;
            _Listener.Port30003MessageReceived += _Port30003MessageReceivedEvent.Handler;
            _Listener.SourceChanged += _SourceChangedEvent.Handler;

            _ExceptionCaughtEvent.EventRaised += DefaultExceptionCaughtHandler;
        }
        public static void SaveToCsv(IStatistics statistics, string sourceSystem, string rootPath)
        {
            if (!Directory.Exists(rootPath))
                throw new DirectoryNotFoundException(rootPath);

            var sb = new StringBuilder();
            sb.AppendFormat("Statistics for {0} {1}\n", statistics.Make, statistics.Model);

            sb.AppendFormat("Highest Price,{0}\n", statistics.HighestPrice);
            sb.AppendFormat("Lowest Price,{0}\n", statistics.LowestPrice);
            sb.AppendFormat("Mean Price,{0}\n", Math.Round(statistics.MeanPrice, 2));
            sb.AppendFormat("Median Price,{0}\n", statistics.MedianPrice);
            sb.AppendFormat("Mode Price,{0}\n", statistics.ModePrice);
            sb.AppendFormat("Standard Deviation,{0}\n", Math.Round(statistics.StandardDeviation, 2));
            sb.AppendFormat("Sample Size,{0}\n", statistics.SampleSize);
            sb.AppendFormat("Outlier vehicles\n");
            statistics.OutlierVehicles.GroupBy(v => v.Vehicle.Year)
                .ToList()
                .ForEach(y => sb.AppendFormat("{0},{1}\n", y.Key, y.Count()));

            var filename = string.Format("{0}\\{1}_SUMMARY {2} {3}.csv", rootPath, sourceSystem, statistics.Make, statistics.Model);
            File.WriteAllText(filename, sb.ToString());
            sb.Clear();

            statistics.MeanPriceByYear.OrderByDescending(s => s.Item1).ToList().ForEach(y => sb.AppendFormat("{0},{1},sample size,{2}\n", y.Item1, Math.Round(y.Item2, 2), y.Item3));
            filename = string.Format("{0}\\{1}_MeanPricePerYear {2} {3}.csv", rootPath, sourceSystem, statistics.Make, statistics.Model);
            File.WriteAllText(filename, sb.ToString());
            sb.Clear();

            statistics.DepreciationByYear.OrderByDescending(s => s.Item1).ToList().ForEach(y => sb.AppendFormat("{0},{1},sample size,{2}\n", y.Item1, Math.Round(y.Item2, 2), y.Item3));
            filename = string.Format("{0}\\{1}_DepreciationPerYear {2} {3}.csv", rootPath, sourceSystem, statistics.Make, statistics.Model);
            File.WriteAllText(filename, sb.ToString());
            sb.Clear();

            statistics.DepreciationByYearCumulative.OrderByDescending(s => s.Item1).ToList().ForEach(y => sb.AppendFormat("{0},{1}\n", y.Item1, Math.Round(y.Item2, 2)));
            filename = string.Format("{0}\\{1}_DepreciationPerYearCumulative {2} {3}.csv", rootPath, sourceSystem, statistics.Make, statistics.Model);
            File.WriteAllText(filename, sb.ToString());
            sb.Clear();
        }
 public PostsPerMonthStatisticsTests()
 {
     _statistics = new PostsPerMonthStatistics();
 }
 /// <summary>
 /// Creates a new object.
 /// </summary>
 public ModeSTranslator()
 {
     _BitStream = Factory.Singleton.Resolve<IBitStream>();
     _Statistics = Factory.Singleton.Resolve<IStatistics>().Singleton;
 }
Exemple #54
0
        public RepostsPerDayStatisticsTests()
        {

            _statistics = new RepostsPerDayStatistics();
        }
Exemple #55
0
 private void OnUserProfileChanged(Object sender, PropertyChangedEventArgs e)
 {
     if (sender == this.Vocabulary && e.PropertyName == "UserProfile")
     {
         if (this.statistics != null)
         {
             this.statistics = null;
             RaisePropertyChangedEvent("Statistics");
         }
     }
 }
Exemple #56
0
        public LikesPerDayStatisticsTests()
        {

            _statistics = new LikesPerDayStatistics();
        }
Exemple #57
0
        public CommentsPerMonthStatisticsTests()
        {

            _statistics = new CommentsPerMonthStatistics();
        }
Exemple #58
0
 protected override void Initialize()
 {
     // import required services.
     this._statistics = (IStatistics)this.Game.Services.GetService(typeof(IStatistics));
 }
Exemple #59
0
        public RepostsPerMonthStatisticsTests()
        {

            _statistics = new RepostsPerMonthStatistics();
        }
 public ProtoChannelClientRunner(IStatistics statistics, TestClientSettings settings)
     : base(statistics, settings)
 {
 }