Exemplo n.º 1
0
 protected void OnUpdateSuccess(MReport report)
 {
     UpdateSuccessHandler handler = this.m_updateSuccessEvent;
     if (handler != null)
     {
         handler(report);
     }
 }
Exemplo n.º 2
0
 protected void OnInsertSuccess(MReport report)
 {
     InsertSuccessHandler handler = this.m_insertSuccessEvent;
     if (handler != null)
     {
         handler(report);
     }
 }
Exemplo n.º 3
0
 protected void OnUpdateError(MReport report)
 {
     UpdateErrorHandler handler = this.m_updateErrorEvent;
     if (handler != null)
     {
         handler(report);
     }
 }
Exemplo n.º 4
0
 protected void OnInsertError(MReport report)
 {
     InsertErrorHandler handler = this.m_insertErrorEvent;
     if (handler != null)
     {
         handler(report);
     }
 }
Exemplo n.º 5
0
 public void UpdateAndInsertReport(MReport report)
 {
     FilterDefinition<MReport> filter = this.FilterBuiler.Eq(r => r.ReportID, report.ReportID)
                                                                              & FilterBuiler.Eq(r => r.ActiveFlag, 1);
     UpdateDefinition<MReport> updater = this.UpdateBuiler.Set(r => r.ActiveFlag, 0);
     try
     {
         IMongoCollection<MReport> ReportCollection = LisMDB.GetCollection<MReport>("labs");
         UpdateResult res = ReportCollection.UpdateOne(filter, updater);
         if (res.IsAcknowledged)
         {
             if (res.MatchedCount == 0 && res.ModifiedCount == 0)
             {
                 this.InsertReport(report);
             }
             else if (res.MatchedCount == res.ModifiedCount)
             {
                 this.OnUpdateSuccess(report);
                 this.InsertReport(report);
             }
             else
             {
                 throw new Exception();
             }
         }
         else
         {
             throw new Exception();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 6
0
 public void InsertReport(MReport report)
 {
     try
     {
         IMongoCollection<MReport> ReportCollection = LisMDB.GetCollection<MReport>("labs");
         ReportCollection.InsertOne(report);
         this.OnInsertSuccess(report);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 7
0
        private void SaveReport(LabReport lr)
        {
            MReport mr = new MReport();
            this.ConvertReport(lr, mr);

            //
            this.MongoService.UpdateAndInsertReport(mr);
        }
Exemplo n.º 8
0
 private void ConvertReport(LabReport lr, MReport mr)
 {
     mr.ReportID = lr.Info.ReportID;
     mr.ActiveFlag = 1;
     this.ConvertInfo(lr.Info, mr.Info);
     this.ConvertItems(lr.ItemList, mr.ItemCollection);
     this.ConvertCustoms(lr.CustomList, mr.CustomCollection);
     this.ConvertImages(lr.ImageList, mr.ImageMap);
 }