Exemple #1
0
        private void Execute(Common.Day item)
        {
            var source      = SourceMongoDb.GetCollection("exevent");
            var destination = DestinationMongoDb.GetCollection("exevent");

            item.BeganAt = DateTime.Now.ToString();
            foreach (var hour in item.Hours)
            {
                try
                {
                    Stopwatch sw = new Stopwatch();
                    sw.Start();
                    IMongoQuery query  = GenerateMongoQuery(item.Year, item.Month, item.Ordinality, hour.Index);
                    var         cursor = source.Find(query);
                    //var local = cursor.ToList();
                    var pickedup = destination.InsertBatch(cursor);
                    hour.Source = pickedup.Count();
                    WriteConcernResult written = source.Remove(query);
                    hour.Destination = (int)written.DocumentsAffected;
                    sw.Stop();
                    hour.Elapsed = sw.Elapsed.TotalMilliseconds;
                }
                catch (Exception ex)
                {
                    hour.Error = ex.Message;
                }
            }
            item.EndedAt = DateTime.Now.ToString();
        }
Exemple #2
0
        public void Execute(int year, int month, int day, int hour)
        {
            XF.Common.Day item = new Common.Day()
            {
                Year = year, Month = month, Ordinality = day
            };
            item.Hours.Add(new Common.Hour()
            {
                Index = hour
            });
            Execute(item);

            MongoCollection <XF.Common.Day> process = DestinationMongoDb.GetCollection <XF.Common.Day>("day");

            process.Insert <XF.Common.Day>(item);
        }
Exemple #3
0
        public void Execute(int year, int month, int day)
        {
            Stopwatch sw = new Stopwatch();

            XF.Common.Day item = new Common.Day()
            {
                Year = year, Month = month, Ordinality = day
            };
            for (int i = 0; i < 24; i++)
            {
                item.Hours.Add(new Common.Hour()
                {
                    Index = i
                });
            }
            sw.Start();
            Execute(item);
            sw.Stop();
            item.Elapsed = sw.Elapsed.TotalMilliseconds;
            MongoCollection <XF.Common.Day> process = DestinationMongoDb.GetCollection <XF.Common.Day>("day");

            process.Insert <XF.Common.Day>(item);
        }