Ejemplo n.º 1
0
        //public static void AddStatusReport(List<StatusReport> reports)
        //{
        //    MongoCollection collection = GetCollection();
        //    collection.InsertBatch(typeof(BsonDocument), reports);
        //}

        public static void Update(ReportStatistics report)
        {
            MongoCollection       collection = GetCollection();
            var                   query      = new QueryDocument("SerialNumber", report.SerialNumber);
            ReportStatisticsCache sr         = collection.FindOneAs <ReportStatisticsCache>(query);

            if (sr != null)
            {
                sr.Account          = report.Account;
                sr.BeginSendTime    = report.BeginSendTime;
                sr.FailureCount     = report.FailureCount;
                sr.LastResponseTime = report.LastResponseTime;
                sr.Numbers          = report.Numbers;
                sr.SendCount        = report.SendCount;
                sr.SerialNumber     = report.SerialNumber;
                sr.SplitNumber      = report.SplitNumber;
                collection.Save(sr);
            }
            else
            {
                sr                  = new ReportStatisticsCache();
                sr.Account          = report.Account;
                sr.BeginSendTime    = report.BeginSendTime;
                sr.FailureCount     = report.FailureCount;
                sr.LastResponseTime = report.LastResponseTime;
                sr.Numbers          = report.Numbers;
                sr.SendCount        = report.SendCount;
                sr.SerialNumber     = report.SerialNumber;
                sr.SplitNumber      = report.SplitNumber;
                collection.Insert <ReportStatisticsCache>(sr);
            }
        }
Ejemplo n.º 2
0
        public static void AddReportStatistics(ReportStatistics report)
        {
            ReportStatisticsCache srm = new ReportStatisticsCache();

            srm.Account          = report.Account;
            srm.BeginSendTime    = report.BeginSendTime;
            srm.FailureCount     = report.FailureCount;
            srm.LastResponseTime = report.LastResponseTime;
            srm.Numbers          = report.Numbers;
            srm.SendCount        = report.SendCount;
            srm.SerialNumber     = report.SerialNumber;
            srm.SplitNumber      = report.SplitNumber;
            MongoCollection collection = GetCollection();

            collection.Insert <ReportStatisticsCache>(srm);
        }