/// <summary> /// Export Collection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ExportCollectionToolStripMenuItem_Click(object sender, EventArgs e) { if (!MongoPathCheck()) { return; } var MongoImportExport = new MongodbDosCommand.StruImportExport(); MongoServerInstance Mongosrv = SystemManager.GetCurrentServer().Instance; MongoImportExport.HostAddr = Mongosrv.Address.Host; MongoImportExport.Port = Mongosrv.Address.Port; MongoImportExport.DBName = SystemManager.GetCurrentDataBase().Name; MongoImportExport.CollectionName = SystemManager.GetCurrentCollection().Name; var dumpFile = new SaveFileDialog { Filter = MongoDbHelper.TxtFilter, CheckFileExists = false }; //if the file not exist,the server will create a new one if (dumpFile.ShowDialog() == DialogResult.OK) { MongoImportExport.FileName = dumpFile.FileName; } MongoImportExport.Direct = MongodbDosCommand.ImprotExport.Export; String DosCommand = MongodbDosCommand.GetMongoImportExportCommandLine(MongoImportExport); RunCommand(DosCommand); }
/// <summary> /// Import Collection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ImportCollectionToolStripMenuItem_Click(object sender, EventArgs e) { String strTitle = "Import Collection"; String strMessage = "Are you sure to Import Collection?"; if (!SystemManager.IsUseDefaultLanguage) { strTitle = SystemManager.MStringResource.GetText(StringResource.TextType.Drop_Data); strMessage = SystemManager.MStringResource.GetText(StringResource.TextType.Drop_Data_Confirm); } if (!MyMessageBox.ShowConfirm(strTitle, strMessage)) { return; } if (!MongoPathCheck()) { return; } var MongoImportExport = new MongodbDosCommand.StruImportExport(); MongoServerInstance Mongosrv = SystemManager.GetCurrentServer().Instance; MongoImportExport.HostAddr = Mongosrv.Address.Host; MongoImportExport.Port = Mongosrv.Address.Port; MongoImportExport.DBName = SystemManager.GetCurrentDataBase().Name; MongoImportExport.CollectionName = SystemManager.GetCurrentCollection().Name; var dumpFile = new OpenFileDialog(); if (dumpFile.ShowDialog() == DialogResult.OK) { MongoImportExport.FileName = dumpFile.FileName; } MongoImportExport.Direct = MongodbDosCommand.ImprotExport.Import; String DosCommand = MongodbDosCommand.GetMongoImportExportCommandLine(MongoImportExport); RunCommand(DosCommand); }