Esempio n. 1
0
 /// <summary>
 ///     ExportToFile
 /// </summary>
 /// <param name="currentDataViewInfo"></param>
 /// <param name="excelFileName"></param>
 /// <param name="exportType"></param>
 /// <param name="mongoCol"></param>
 public static void ExportToFile(DataViewInfo currentDataViewInfo,
     string excelFileName,
     EnumMgr.ExportType exportType,
     MongoCollection mongoCol)
 {
     MongoCursor<BsonDocument> cursor;
     //Query condition:
     if (currentDataViewInfo != null && currentDataViewInfo.IsUseFilter)
     {
         cursor = mongoCol.FindAs<BsonDocument>(
             QueryHelper.GetQuery(currentDataViewInfo.MDataFilter.QueryConditionList))
             .SetFields(QueryHelper.GetOutputFields(currentDataViewInfo.MDataFilter.QueryFieldList))
             .SetSortOrder(QueryHelper.GetSort(currentDataViewInfo.MDataFilter.QueryFieldList));
     }
     else
     {
         cursor = mongoCol.FindAllAs<BsonDocument>();
     }
     var dataList = cursor.ToList();
     switch (exportType)
     {
         case EnumMgr.ExportType.Excel:
             //ExportToExcel(dataList, ExcelFileName);
             GC.Collect();
             break;
         case EnumMgr.ExportType.Text:
             ExportToJson(dataList, excelFileName, MongoHelper.JsonWriterSettings);
             break;
         case EnumMgr.ExportType.Xml:
             break;
     }
     MongoHelper.OnActionDone(new ActionDoneEventArgs(" Completed "));
 }
Esempio n. 2
0
 /// <summary>
 ///     ExportToFile
 /// </summary>
 /// <param name="currentDataViewInfo"></param>
 /// <param name="excelFileName"></param>
 /// <param name="exportType"></param>
 /// <param name="mongoCol"></param>
 public static void ExportToFile(DataViewInfo currentDataViewInfo,
     string excelFileName,
     EnumMgr.ExportType exportType,
     MongoCollection mongoCol)
 {
     MongoCursor<BsonDocument> cursor;
     cursor = mongoCol.FindAllAs<BsonDocument>();
     var dataList = cursor.ToList();
     switch (exportType)
     {
         case EnumMgr.ExportType.Text:
             ExportToJson(dataList, excelFileName, MongoHelper.JsonWriterSettings);
             break;
         case EnumMgr.ExportType.Excel:
         case EnumMgr.ExportType.Xml:
             break;
     }
     MongoHelper.OnActionDone(new ActionDoneEventArgs(" Completed "));
 }
Esempio n. 3
0
 /// <summary>
 ///     初始化
 /// </summary>
 /// <param name="commandDocument"></param>
 /// <param name="runLevel"></param>
 public MongoCommand(CommandDocument commandDocument, EnumMgr.PathLevel runLevel)
 {
     CmdDocument = commandDocument;
     RunLevel = runLevel;
     CommandString = string.Empty;
 }
Esempio n. 4
0
 /// <summary>
 ///     初始化
 /// </summary>
 /// <param name="commandString"></param>
 /// <param name="runLevel"></param>
 public MongoCommand(string commandString, EnumMgr.PathLevel runLevel)
 {
     CommandString = commandString;
     RunLevel = runLevel;
     CmdDocument = new CommandDocument {{commandString, 1}};
 }
Esempio n. 5
0
 /// <summary>
 ///     初始化
 /// </summary>
 /// <param name="commandDocument"></param>
 /// <param name="runLevel"></param>
 public MongoCommand(CommandDocument commandDocument, EnumMgr.PathLevel runLevel, string databaseName = "", string collectionName = "")
 {
     CmdDocument = commandDocument;
     RunLevel = runLevel;
     CommandString = string.Empty;
     DatabaseName = databaseName;
     CollectionName = collectionName;
 }
Esempio n. 6
0
 /// <summary>
 ///     初始化
 /// </summary>
 /// <param name="commandString"></param>
 /// <param name="runLevel"></param>
 public MongoCommand(string commandString, EnumMgr.PathLevel runLevel, string databaseName = "", string collectionName = "")
 {
     CommandString = commandString;
     RunLevel = runLevel;
     CmdDocument = new CommandDocument { { commandString, 1 } };
     DatabaseName = databaseName;
     CollectionName = collectionName;
 }