/// <summary> /// Update defaults profile from project properties /// </summary> /// <remarks>Call after Load()</remarks> public void UpdateDefaults(string projectDefaults) { Debug.Assert(null != Profiles); // NOTE: load first if ((Profiles.Count == 0) || string.IsNullOrEmpty(projectDefaults)) { return; // update not needed } // split by groups (1 group for every type) char[] groupSplitters = new char[] { SPLITTER_GROUP }; string[] groups = projectDefaults.Split(new char[] { SPLITTER_GROUPS }, StringSplitOptions.RemoveEmptyEntries); for (int groupNum = 0; groupNum < groups.Length; ++groupNum) { // split by group info string[] group = groups[groupNum].Split(groupSplitters); Debug.Assert(2 == group.Length); bool isSupportedType = true; ImportType type = ImportType.Orders; try { type = (ImportType)Enum.Parse(typeof(ImportType), group[0]); } catch { isSupportedType = false; } if (!isSupportedType) { continue; // NOTE: found not supported type - ignore this. } string name = group[1]; bool isUpdateNeeded = false; foreach (ImportProfile profile in Profiles) { if (name.Equals(profile.Name, StringComparison.OrdinalIgnoreCase) && (type == profile.Type)) { if (!profile.IsDefault) { isUpdateNeeded = true; } break; // founded } } if (!isUpdateNeeded) { continue; // update not needed } foreach (ImportProfile profile in Profiles) { if (type == profile.Type) { profile.IsDefault = name.Equals(profile.Name, StringComparison.OrdinalIgnoreCase); } } } }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// private List <FieldMap> _LoadFieldsMap(XmlNode nodeFieldsMap, ImportType type) { StringDictionary mapTitle2Name = PropertyHelpers.GetTitle2NameMap(type); List <FieldMap> fieldsMap = new List <FieldMap>(); foreach (XmlNode node in nodeFieldsMap.ChildNodes) { if (node.NodeType != XmlNodeType.Element) { continue; // skip comments and other non element nodes } if (node.Name.Equals(NODE_NAME_FIELDSMAP, StringComparison.OrdinalIgnoreCase)) { FieldMap fieldMap = new FieldMap(node.Attributes[ATTRIBUTE_NAME_DSTFIELD].Value, node.Attributes[ATTRIBUTE_NAME_SRCFIELD].Value); if (mapTitle2Name.ContainsValue(fieldMap.ObjectFieldName)) { fieldsMap.Add(fieldMap); } } } return(fieldsMap); }
private static List <string> ConfigExtart(ImportType importType, ModelThree modelThree) { List <string> extartList = new List <string>(); if (importType == ImportType.Pet) { petConfig.ForEach(item => { if (modelThree.nodeList.Find(modelNode => modelNode.path == item) != null) { extartList.Add(item); } }); } else if (importType == ImportType.Ride) { rideConfig.ForEach(item => { if (modelThree.nodeList.Find(modelNode => modelNode.path == item) != null) { extartList.Add(item); } }); } return(extartList); }
private static void ModelOptimizeGmaeObjectOnImport(ModelImporter modelImporter) { if (modelImporter.optimizeGameObjects) { return; } if (modelImporter.assetPath.IsGameModel() && (ignorModelPath.Any(item => modelImporter.assetPath.StartsWith(item) == false))) { ImportType importType = GetImportType(GetPathName(modelImporter.assetPath)); GameObject modelAsset = AssetDatabase.LoadAssetAtPath <GameObject>(modelImporter.assetPath); ModelThree modelThree = new ModelThree(modelAsset); List <string> configExtartList = ConfigExtart(importType, modelThree); List <string> extarPaths = new List <string>(); extarPaths.AddRange(configExtartList); modelThree.nodeList.ForEach(item => { if (GetPathName(item.path).StartsWith(particleView)) { extarPaths.Add(item.path); } }); modelImporter.optimizeGameObjects = true; modelImporter.extraExposedTransformPaths = extarPaths.Distinct().ToArray(); } }
private void rbIncentive_CheckedChanged(object sender, EventArgs e) { if (rbIncentive.Checked) { importType = ImportType.Incentive; } }
private void rbEmployee_CheckedChanged(object sender, EventArgs e) { if (rbEmployee.Checked) { importType = ImportType.Employee; } }
private void rbAbsence_CheckedChanged(object sender, EventArgs e) { if (rbAbsence.Checked) { importType = ImportType.Absence; } }
/// <summary> /// Reorders field info. /// </summary> /// <param name="type">Import type.</param> /// <param name="list">Object data field info list to reording.</param> static private void _ReorderFieldInfos(ImportType type, List <ObjectDataFieldInfo> list) { if ((ImportType.Orders == type) || (ImportType.Locations == type)) { // reorder Addresses field - start after name AddressField[] fields = App.Current.Geocoder.AddressFields; // find index first address field in infos int startAddressesFieldIndex = -1; for (int index = 0; index < list.Count; ++index) { if (fields[0].Title == list[index].Info.Name) { startAddressesFieldIndex = index; break; // result founded } } Debug.Assert(-1 != startAddressesFieldIndex); // copy address fields List <ObjectDataFieldInfo> addressFieldList = list.GetRange(startAddressesFieldIndex, fields.Length); // remove address fields in old position list.RemoveRange(startAddressesFieldIndex, fields.Length); // insert to new position (after name) list.InsertRange(NAME_FIELD_POSITION + 1, addressFieldList); } }
private void setBusinessVolumeParams(ImportParam importParam, ImportType importType) { string fileName; switch (importType) { case ImportType.ActualBusinessVolume: fileName = ImportManager.BusinessVolumeActualFileSearchPattern; break; case ImportType.TargetBusinessVolume: fileName = ImportManager.BusinessVolumeTargetFileSearchPattern; break; case ImportType.CashRegisterReceipt: fileName = ImportManager.CashRegisterReceiptFileSearchPattern; break; default: goto case ImportType.ActualBusinessVolume; } ServerImportFoldersInfo serverImportFoldersInfo = importParam.StoreService.GetServerImportFoldersInfo(); addTextToMemo(string.Format(GetLocalized("BVInformation"), serverImportFoldersInfo.SourceFolder, fileName, serverImportFoldersInfo.ImportedFolder)); _ImportFormType = importType; }
private void ImportData(ImportType importType, string fileName) { switch (importType) { case ImportType.Employee: ImportEmployee(fileName); ImportEmployeeDetail(fileName); break; case ImportType.Absence: absenceRepository.Delete(Store.ActiveMonth, Store.ActiveYear); ImportAbsence(fileName); break; case ImportType.Overtime: overTimeRepository.Delete(Store.ActiveMonth, Store.ActiveYear); ImportOvertime(fileName); break; case ImportType.Incentive: incentiveRepository.Delete(Store.ActiveMonth, Store.ActiveYear); ImportIncentive(fileName); break; } }
public static System.Data.DataSet ImportExcelData(ImportType importType, string fileName, bool firstRowContainsHeaders, string worksheetName, string startRange, string endRange) { string sql = String.Format(SELECT_SQL, "*", "[" + worksheetName + startRange + ":" + endRange + "]"); ExcelProperties properties = new ExcelProperties(firstRowContainsHeaders, true, importType == ImportType.CSV); return(ExcelUtility.Fill(fileName, sql, null, properties)); }
public static System.Data.DataSet ImportExcelData(ImportType importType, string fileName, bool firstRowContainsHeaders, string worksheetName, string[] columns) { string selectColumns = string.Empty; for (int i = 0; i < columns.Length; i++) { if (i == 0) { selectColumns = columns[i]; } else { selectColumns += "," + columns[i]; } } if (selectColumns.Trim() == string.Empty) { selectColumns = "*"; } string sql = String.Format(SELECT_SQL, selectColumns, "[" + worksheetName + "]"); ExcelProperties properties = new ExcelProperties(firstRowContainsHeaders, true, importType == ImportType.CSV); return(ExcelUtility.Fill(fileName, sql, null, properties)); }
public static string[] GetExcelColumnNames(ImportType importType, string filePath, bool firstRowContainsHeaders, string worksheetName) { throw new NotImplementedException("(US328120) - OleDb is not supported in DotNet Core"); // try // { // ExcelProperties properties = new ExcelProperties(firstRowContainsHeaders, true, importType == ImportType.CSV); // DataTable table = ExcelUtility.GetOleDbSchemaTable(filePath, System.Data.OleDb.OleDbSchemaGuid.Columns, new[] { null, null, worksheetName, null }, properties); // ArrayList cols = new ArrayList(); // try // { // for (int i = 0; i < table.Rows.Count; i++) // { // //if(table.Rows[i][TABLE_NAME].ToString() == worksheetName) // cols.Add(table.Rows[i][COLUMN_NAME].ToString()); // } // } // finally { table.Dispose(); } // string[] retVal = new string[cols.Count]; // cols.CopyTo(retVal); // return retVal; // } // catch (Exception ex) { throw ex; } // finally // { //// conn.Close(); //// conn.Dispose(); // } }
private ImportSettings _LoadSettings(XmlNode nodeSettings, ImportType type) { ImportSettings settings = new ImportSettings(); foreach (XmlNode node in nodeSettings.ChildNodes) { if (node.NodeType != XmlNodeType.Element) { continue; // skip comments and other non element nodes } if (node.Name.Equals(NODE_NAME_SOURCE, StringComparison.OrdinalIgnoreCase)) { if (null != node.FirstChild) { settings.Source = node.FirstChild.Value; } } else if (node.Name.Equals(NODE_NAME_TABLE, StringComparison.OrdinalIgnoreCase)) { settings.TableName = node.Attributes[ATTRIBUTE_NAME_NAME].Value; } else if (node.Name.Equals(NODE_NAME_FIELDSMAPPING, StringComparison.OrdinalIgnoreCase)) { settings.FieldsMap = _LoadFieldsMap(node, type); } } return(settings); }
private void rbOvertime_CheckedChanged(object sender, EventArgs e) { if (rbOvertime.Checked) { importType = ImportType.Overtime; } }
public bool BulkInsert <T>(List <T> bulkInsertItems, ImportType importType) where T : class { var conString = _dbContextRFStaging.Database.Connection.ConnectionString; using (var connection = new SqlConnection(conString)) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); using (var bulkCopy = new SqlBulkCopy(connection, SqlBulkCopyOptions.Default, transaction)) { bulkCopy.BatchSize = 100; //var destinationTableName = bulkInsertItems.GetType().ToString().Split('.').LastOrDefault(); //destinationTableName = destinationTableName.Remove(destinationTableName.Length - 1); bulkCopy.DestinationTableName = string.Format("[dbo].[{0}]", importType.ToString().ToLower()); try { var data = bulkInsertItems.AsDataTable(); bulkCopy.WriteToServer(data); } catch (Exception exception) { Console.WriteLine(exception.Message.ToString()); transaction.Rollback(); connection.Close(); } } transaction.Commit(); } return(true); }
public ImportAudit(DateTime timeStarted, int rowsImported, ImportType importType = 0) { TimeStarted = timeStarted; RowsImported = rowsImported; TimeFinished = DateTime.UtcNow; ImportType = importType; }
private Settings() { Banks = new List <string>(); RealChannelSettings = new List <PlatformIntSetting>(); VirtualChannelSettings = new List <PlatformIntSetting>(); LoggingSettings = new List <PlatformBoolSetting>(); LiveUpdateSettings = new List <PlatformBoolSetting>(); OverlaySettings = new List <PlatformBoolSetting>(); SampleRateSettings = new List <PlatformIntSetting>(); SpeakerModeSettings = new List <PlatformIntSetting>(); BankDirectorySettings = new List <PlatformStringSetting>(); SetSetting(LoggingSettings, FMODPlatform.PlayInEditor, TriStateBool.Enabled); SetSetting(LiveUpdateSettings, FMODPlatform.PlayInEditor, TriStateBool.Enabled); SetSetting(OverlaySettings, FMODPlatform.PlayInEditor, TriStateBool.Enabled); SetSetting(RealChannelSettings, FMODPlatform.PlayInEditor, 256); SetSetting(VirtualChannelSettings, FMODPlatform.PlayInEditor, 1024); SetSetting(LoggingSettings, FMODPlatform.Default, TriStateBool.Disabled); SetSetting(LiveUpdateSettings, FMODPlatform.Default, TriStateBool.Disabled); SetSetting(OverlaySettings, FMODPlatform.Default, TriStateBool.Disabled); SetSetting(RealChannelSettings, FMODPlatform.Default, 32); SetSetting(VirtualChannelSettings, FMODPlatform.Default, 128); SetSetting(SampleRateSettings, FMODPlatform.Default, 0); SetSetting(SpeakerModeSettings, FMODPlatform.Default, 3); ImportType = ImportType.StreamingAssets; AutomaticEventLoading = true; AutomaticSampleLoading = false; TargetAssetPath = string.Empty; }
/// <summary> /// Does import object. /// </summary> /// <param name="references">Dictionary property name to field position in data source.</param> /// <param name="currentNumber">Current record number.</param> private void _ImportObject(Dictionary <string, int> references, int currentNumber) { Debug.Assert(null != _profile); // inited Debug.Assert(null != _provider); // inited Debug.Assert(null != _projectData); // inited Debug.Assert(null != references); // created try { ImportType type = _profile.Type; ImportResult res = CreateHelpers.Create(type, references, _provider, _projectData, _defaultDate); _IsObjectSkipped(res, currentNumber); } catch (Exception ex) { Logger.Error(ex); // store problem description string text = App.Current.GetString("ImportProcessStatusRecordFailed", _informer.ObjectName, currentNumber); var description = new MessageDetail(MessageType.Warning, text); _details.Add(description); ++_failedCount; } }
public ImportUnmanagedAttribute(string moduleName, string name, ImportType type, string value = null) : base(name, ImportManageType.Unmanaged) { ModuleName = moduleName; Type = type; Value = value; }
private Settings() { Banks = new List <string>(); RealChannelSettings = new List <PlatformIntSetting>(); VirtualChannelSettings = new List <PlatformIntSetting>(); LoggingSettings = new List <PlatformBoolSetting>(); LiveUpdateSettings = new List <PlatformBoolSetting>(); OverlaySettings = new List <PlatformBoolSetting>(); SampleRateSettings = new List <PlatformIntSetting>(); SpeakerModeSettings = new List <PlatformIntSetting>(); BankDirectorySettings = new List <PlatformStringSetting>(); // Default play in editor settings SetSetting(LoggingSettings, FMODPlatform.PlayInEditor, TriStateBool.Enabled); SetSetting(LiveUpdateSettings, FMODPlatform.PlayInEditor, TriStateBool.Enabled); SetSetting(OverlaySettings, FMODPlatform.PlayInEditor, TriStateBool.Enabled); // These are not editable, set them high SetSetting(RealChannelSettings, FMODPlatform.PlayInEditor, 256); SetSetting(VirtualChannelSettings, FMODPlatform.PlayInEditor, 1024); // Default runtime settings SetSetting(LoggingSettings, FMODPlatform.Default, TriStateBool.Disabled); SetSetting(LiveUpdateSettings, FMODPlatform.Default, TriStateBool.Disabled); SetSetting(OverlaySettings, FMODPlatform.Default, TriStateBool.Disabled); SetSetting(RealChannelSettings, FMODPlatform.Default, 32); // Match the default in the low level SetSetting(VirtualChannelSettings, FMODPlatform.Default, 128); SetSetting(SampleRateSettings, FMODPlatform.Default, 0); SetSetting(SpeakerModeSettings, FMODPlatform.Default, (int)FMOD.SPEAKERMODE.STEREO); ImportType = ImportType.StreamingAssets; AutomaticEventLoading = true; AutomaticSampleLoading = false; TargetAssetPath = ""; }
public M_ClassImportGeneral(ImportType type) { //New M_FormChooseFile FileChooser = new M_FormChooseFile(); if(FileChooser.ShowDialog() == System.Windows.Forms.DialogResult.OK){ //Grab File //Chars char[] CharMap = new char[3]; CharMap[0] = (char)44; //Comma CharMap[1] = (char)9; //Tab CharMap[2] = (char)124; //VLine | List<string> lines = (File.ReadAllLines(FileChooser.fileName) //Leave blank lines //.Where(line => !string.IsNullOrEmpty(line)) .Select(line => line.Split(CharMap,StringSplitOptions.RemoveEmptyEntries)) .Select(values => string.Join("_", values)) .ToList<string>()); if (type == ImportType.Apex) { M_ClassApex Apex = new M_ClassApex(lines); DT = Apex.getData(); } } }
protected object TriggerImport(ImportType importType, bool updateFiles) { Parameters["download"] = updateFiles ? "true" : "false"; switch (importType) { case ImportType.Suggest: Request.Action = RequestType.Import; Parameters["type"] = "suggest"; break; case ImportType.Recommendations: Request.Action = RequestType.Recommendation; Parameters["do"] = "importData"; break; case ImportType.Data: default: Request.Action = RequestType.Import; break; } var report = JsonData; switch (importType) { case ImportType.Suggest: Parameters.Remove("type"); break; case ImportType.Recommendations: Parameters.Remove("do"); break; } return report; }
public void ChooseExportType() { bool validChoice = false; bool firstPass = true; while (!validChoice) { Console.Clear(); Console.WriteLine($"Please select a file format to convert your {ImportType.ToString()} to:"); foreach (var type in AvailableTypes) { Console.WriteLine($"{(int)type}: {type.ToString()}"); } if (!firstPass) { Console.WriteLine("Invalid selection"); } Console.WriteLine(); var choice = Console.ReadKey(); CheckForEscapeOption(choice); if (Enum.TryParse <ImportType>(choice.KeyChar.ToString(), out ImportType selectedType)) { ExportType = selectedType; validChoice = true; } } }
public void ImportObjects(string[] lines, ImportType importType) { string[] currLine; foreach (string line in lines) { currLine = line.Split(new char[] { (importType == ImportType.ByFlux) ? char.Parse(Radioobject.STANDART_STRING_DELIMETER) : ' ' }, StringSplitOptions.RemoveEmptyEntries); switch (importType) { case ImportType.ByFlux: Radioobjects.Add(new Radioobject( coords: new Coordinates(currLine[0]), fluxOn325: double.Parse(currLine[1]), fluxOn1400: double.Parse(currLine[2]), spectralIndex: double.Parse(currLine[3].Replace('.', ',')), type: Radioobject.ParseType(currLine[4]), densityRatio: double.Parse(currLine[5]), redshift: double.Parse(currLine[6]) )); break; case ImportType.BySpectralIndex: Radioobjects.Add(new Radioobject( coords: new Coordinates(currLine[0], currLine[1], ':'), spectralIndex: double.Parse(currLine[2].Replace('.', ',')) )); break; } } ReportToLog("Objects were imported."); }
public static ReflectionMemberImportDefinition CreateMemberImportDefinition(MemberInfo member, ICompositionElement origin) { Requires.NotNull(member, "member"); ReflectionWritableMember reflectionMember = member.ToReflectionWritableMember(); IAttributedImport attributedImport = AttributedModelDiscovery.GetAttributedImport(reflectionMember, member); ImportType importType = new ImportType(reflectionMember.ReturnType, attributedImport.Cardinality); if (importType.IsPartCreator) { return(new PartCreatorMemberImportDefinition( new LazyMemberInfo(member), origin, new ContractBasedImportDefinition( attributedImport.GetContractNameFromImport(importType), attributedImport.GetTypeIdentityFromImport(importType), CompositionServices.GetRequiredMetadata(importType.MetadataViewType), attributedImport.Cardinality, attributedImport.AllowRecomposition, false, CreationPolicy.NonShared))); } else { return(new ReflectionMemberImportDefinition( new LazyMemberInfo(member), attributedImport.GetContractNameFromImport(importType), attributedImport.GetTypeIdentityFromImport(importType), CompositionServices.GetRequiredMetadata(importType.MetadataViewType), attributedImport.Cardinality, attributedImport.AllowRecomposition, attributedImport.RequiredCreationPolicy, origin)); } }
public static ReflectionParameterImportDefinition CreateParameterImportDefinition(ParameterInfo parameter, ICompositionElement origin) { Requires.NotNull(parameter, "parameter"); ReflectionParameter reflectionParameter = parameter.ToReflectionParameter(); IAttributedImport attributedImport = AttributedModelDiscovery.GetAttributedImport(reflectionParameter, parameter); ImportType importType = new ImportType(reflectionParameter.ReturnType, attributedImport.Cardinality); if (importType.IsPartCreator) { return(new PartCreatorParameterImportDefinition( new Lazy <ParameterInfo>(() => parameter), origin, new ContractBasedImportDefinition( attributedImport.GetContractNameFromImport(importType), attributedImport.GetTypeIdentityFromImport(importType), CompositionServices.GetRequiredMetadata(importType.MetadataViewType), attributedImport.Cardinality, false, true, CreationPolicy.NonShared))); } else { return(new ReflectionParameterImportDefinition( new Lazy <ParameterInfo>(() => parameter), attributedImport.GetContractNameFromImport(importType), attributedImport.GetTypeIdentityFromImport(importType), CompositionServices.GetRequiredMetadata(importType.MetadataViewType), attributedImport.Cardinality, attributedImport.RequiredCreationPolicy, origin)); } }
public override void DrawCustomInspector() { GUILayout.Label("Databox Object:"); databoxObject = (DataboxObject)EditorGUILayout.ObjectField(databoxObject, typeof(DataboxObject), false); GUILayout.Label("Import type:"); importType = (ImportType)EditorGUILayout.EnumPopup(importType); }
public CloseImportConnectionResults CloseImportConnectionDetached(CloseImportConnectionRunStep importRunStep) { Tracer.Enter(nameof(CloseImportConnectionDetached)); CloseImportConnectionResults result = new CloseImportConnectionResults(); try { if (Configuration.RunAfterImport) { List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("importtype", ImportType.ToString())); parameters.Add(new SqlParameter("customdata", CustomData)); methods.RunStoredProcedure(Configuration.ImportCommandAfter, parameters); parameters.Clear(); parameters = null; } methods.CloseConnection(); if (importAnchors != null) { importAnchors.Clear(); importAnchors = null; } GC.Collect(); } catch (Exception ex) { Tracer.TraceError(nameof(CloseImportConnectionDetached), ex); throw; } finally { Tracer.Exit(nameof(CloseImportConnectionDetached)); } return(result); }
/// <summary> /// import mods as an asynchronous operation. /// </summary> /// <param name="importType">Type of the import.</param> /// <param name="file">The file.</param> /// <returns>IModCollection.</returns> protected virtual async Task <IModCollection> ImportModsAsync(ImportType importType, string file = Shared.Constants.EmptyParam) { async Task <IModCollection> performImport(IGame game) { var instance = Create(); var parameters = new ModCollectionExporterParams() { ModDirectory = Path.Combine(game.UserDirectory, Shared.Constants.ModDirectory), File = file, Mod = instance }; ICollectionImportResult result = null; switch (importType) { case ImportType.Paradox: result = await modCollectionExporter.ImportParadoxAsync(parameters); break; case ImportType.ParadoxLauncher: result = await modCollectionExporter.ImportParadoxLauncherAsync(parameters); break; case ImportType.Paradoxos: result = await modCollectionExporter.ImportParadoxosAsync(parameters); break; case ImportType.ParadoxLauncherBeta: result = await modCollectionExporter.ImportParadoxLauncherBetaAsync(parameters); break; case ImportType.ParadoxLauncherJson: result = await modCollectionExporter.ImportParadoxLauncherJsonAsync(parameters); break; default: break; } if (result != null) { // Order of operations is very important here MapImportResult(instance, result); return(instance); } return(null); } var game = GameService.GetSelected(); if (game == null) { return(null); } return(await performImport(game)); }
/// <summary> /// Starts the import. /// </summary> /// <param name="importType">Type of the import.</param> private void StartImport(ImportType importType) { var physicalSlingshotFile = this.Request.MapPath(fupSlingshotFile.UploadedContentFilePath); long totalMilliseconds = 0; var importTask = new Task(() => { // wait a little so the browser can render and start listening to events System.Threading.Thread.Sleep(1000); _hubContext.Clients.All.showButtons(this.SignalRNotificationKey, false); _hubContext.Clients.All.showLog(); Stopwatch stopwatch = Stopwatch.StartNew(); _importer = new Rock.Slingshot.SlingshotImporter(physicalSlingshotFile, tbForeignSystemKey.Text); _importer.FinancialTransactionChunkSize = 100000; _importer.OnProgress += _importer_OnProgress; if (importType == ImportType.ImportPhotos) { _importer.TEST_UseSampleLocalPhotos = false; _importer.DoImportPhotos(); } else { _importer.DoImport(); } stopwatch.Stop(); if (_importer.Exceptions.Any()) { _importer.Results.Add("ERRORS", string.Join(Environment.NewLine, _importer.Exceptions.Select(a => a.Message).ToArray())); } totalMilliseconds = stopwatch.ElapsedMilliseconds; _hubContext.Clients.All.showButtons(this.SignalRNotificationKey, true); }); importTask.ContinueWith((t) => { if (t.IsFaulted) { foreach (var exception in t.Exception.InnerExceptions) { _importer.Exceptions.Add(exception.GetBaseException()); } _importer_OnProgress(null, "ERROR"); } else { _importer_OnProgress(null, string.Format("{0} Complete: [{1}ms]", importType.ConvertToString(), totalMilliseconds)); } }); importTask.Start(); }
private void SaveMatchedTables() { StringBuilder sb = new StringBuilder(64); try { int successCount = 0; foreach (DataTable dt in ListMatchedData) { var config = GetDataTableConfig(dt); bool isSuccess = false; string msg; ImportType type = config.Count == MarketDetailCol.Length ? ImportType.Market : ImportType.Trader; if (config.Count == 0) { msg = "未能从文件名中识别出导入数据类型,将跳过此文件:" + dt.TableName; } else if (config.Count == MarketDetailCol.Length) { isSuccess = SaveAsMarket(dt, config, false, out msg); } else { isSuccess = SaveAsTrader(dt, config, false, out msg); } if (isSuccess) { successCount++; } else { if (!string.IsNullOrEmpty(msg)) { sb.AppendLine(msg); } ListNotMatchedData.Add(dt); } } if (sb.Length > 0) { CommonUtils.Log("保存记录:" + sb.ToString()); } var message = string.Format("批量保存{0}个文件,成功{1}个,失败{2}个。", ListMatchedData.Count, successCount, ListMatchedData.Count - successCount); if (successCount < ListMatchedData.Count) { message += "失败文件将转入单独保存列表,详细信息请查看日志中的保存记录。"; } this.Dispatcher.ShowMsg(message); } catch (Exception ex) { CommonUtils.Log("存入数据库时出现异常!", ex); this.Dispatcher.ShowMsg("保存失败,详情请检查日志!"); } }
public void AddImportTab(Dataset dataset, int tableId, ImportType importType) { TabItem t = new TabItem(); t.Header = "Import into " + dataset.Title; t.Content = new Import(dataset, tableId, importType); tabControl.Items.Add(t); tabControl.SelectedItem = t; }
public static IDataExtractor Get(IEnumerable<string> paths, ImportType type) { switch (type) { case ImportType.Files: return new FolderExtractor(paths); case ImportType.DataFile: return new ExcelExtractor(paths.Single()); default: throw new NotImplementedException(); } }
public ArangoResponse<BulkImportResult> Import(Stream stream, string collection, ImportType type = ImportType.Auto, bool createCollection = false, bool waitForSync = false, bool complete = true, bool details = true, string database = null) { return Dispatcher.Send(new BulkImport { Collection = collection, Complete = complete, CreateCollection = createCollection, Database = GetDatabase(database), Details = details, BodyStream = stream, Type = type, WaitForSync = waitForSync }); }
public FrmImport(ImportParam importParam, ImportType importFormType) { InitializeComponent(); _ImportFormType = importFormType; _BeenRunSuccessfully = false; _CountryService = importParam.CountryService; _RegionService = importParam.RegionService; _StoreService = importParam.StoreService; _EmployeeService = importParam.EmployeeService; _CanClose = true; _NeedFileDialog = isNeedFileDialog(); if (!_NeedFileDialog) setBusinessVolumeParams(importParam, importFormType); LocalizeUI(); }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Creates and initializes a new instance of the <c>ProgressTracker</c> class. /// </summary> /// <param name="parentPage">Parent page for status panel.</param> /// <param name="type">Import objects type.</param> /// <param name="canceler">Operation canceler interface (can be NULL).</param> public ProgressInformer(AppPages.Page parentPage, ImportType type, ICanceler canceler) { Debug.Assert(null != parentPage); // created // store context _parentPage = parentPage; _canceler = canceler; // initialize state _InitStrings(type); _InitStatusStack(); }
private object[] GetServicesArray(ImportType importType) { object[] services; switch (importType) { case ImportType.Country: case ImportType.Absence: case ImportType.Feast: case ImportType.WorkingDays: services = new object[] { _CountryService }; break; case ImportType.Region: services = new object[] { _CountryService, _RegionService }; break; case ImportType.Store: services = new object[] { _CountryService, _RegionService, _StoreService }; break; case ImportType.World: case ImportType.HWGR: case ImportType.WGR: case ImportType.ActualBusinessVolume: case ImportType.TargetBusinessVolume: case ImportType.CashRegisterReceipt: services = new object[] { _StoreService }; break; case ImportType.Employee: case ImportType.LongTimeAbsence: case ImportType.TimePlanning: case ImportType.TimeRecording: services = new object[] { _EmployeeService }; break; default: throw new NotSupported(); } return services; }
public Import(Dataset dataset, int tableId, ImportType importType) : this(dataset) { model.SetParentTableFromId(tableId); this.importType = importType; }
/// <summary> /// /// </summary> /// <param name="path"></param> /// <param name="item"></param> /// <param name="type"></param> public void ImportObject(string path, object item, ImportType type) { try { switch (type) { case ImportType.Style: { var sg = item as StyleLibrary; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<ShapeStyle>(json); var previous = sg.Styles; var next = sg.Styles.Add(import); _editor.History.Snapshot(previous, next, (p) => sg.Styles = p); sg.Styles = next; } break; case ImportType.Styles: { var sg = item as StyleLibrary; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<IList<ShapeStyle>>(json); var builder = sg.Styles.ToBuilder(); foreach (var style in import) { builder.Add(style); } var previous = sg.Styles; var next = builder.ToImmutable(); _editor.History.Snapshot(previous, next, (p) => sg.Styles = p); sg.Styles = next; } break; case ImportType.StyleLibrary: { var project = item as Project; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<StyleLibrary>(json); var previous = project.StyleLibraries; var next = project.StyleLibraries.Add(import); _editor.History.Snapshot(previous, next, (p) => project.StyleLibraries = p); project.StyleLibraries = next; } break; case ImportType.StyleLibraries: { var project = item as Project; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<IList<StyleLibrary>>(json); var builder = project.StyleLibraries.ToBuilder(); foreach (var sg in import) { builder.Add(sg); } var previous = project.StyleLibraries; var next = builder.ToImmutable(); _editor.History.Snapshot(previous, next, (p) => project.StyleLibraries = p); project.StyleLibraries = next; } break; case ImportType.Group: { var gl = item as GroupLibrary; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<XGroup>(json); var shapes = Enumerable.Repeat(import as XGroup, 1); TryToRestoreStyles(shapes); TryToRestoreRecords(shapes); var previous = gl.Groups; var next = gl.Groups.Add(import); _editor.History.Snapshot(previous, next, (p) => gl.Groups = p); gl.Groups = next; } break; case ImportType.Groups: { var gl = item as GroupLibrary; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<IList<XGroup>>(json); var shapes = import; TryToRestoreStyles(shapes); TryToRestoreRecords(shapes); var builder = gl.Groups.ToBuilder(); foreach (var group in import) { builder.Add(group); } var previous = gl.Groups; var next = builder.ToImmutable(); _editor.History.Snapshot(previous, next, (p) => gl.Groups = p); gl.Groups = next; } break; case ImportType.GroupLibrary: { var project = item as Project; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<GroupLibrary>(json); var shapes = import.Groups; TryToRestoreStyles(shapes); TryToRestoreRecords(shapes); var previous = project.GroupLibraries; var next = project.GroupLibraries.Add(import); _editor.History.Snapshot(previous, next, (p) => project.GroupLibraries = p); project.GroupLibraries = next; } break; case ImportType.GroupLibraries: { var project = item as Project; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<IList<GroupLibrary>>(json); var shapes = import.SelectMany(x => x.Groups); TryToRestoreStyles(shapes); TryToRestoreRecords(shapes); var builder = project.GroupLibraries.ToBuilder(); foreach (var library in import) { builder.Add(library); } var previous = project.GroupLibraries; var next = builder.ToImmutable(); _editor.History.Snapshot(previous, next, (p) => project.GroupLibraries = p); project.GroupLibraries = next; } break; case ImportType.Template: { var project = item as Project; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<Container>(json); var shapes = import.Layers.SelectMany(x => x.Shapes); TryToRestoreStyles(shapes); TryToRestoreRecords(shapes); var previous = project.Templates; var next = project.Templates.Add(import); _editor.History.Snapshot(previous, next, (p) => project.Templates = p); project.Templates = next; } break; case ImportType.Templates: { var project = item as Project; var json = Utf8TextFile.Read(path); var import = _serializer.Deserialize<IList<Container>>(json); var shapes = import.SelectMany(x => x.Layers).SelectMany(x => x.Shapes); TryToRestoreStyles(shapes); TryToRestoreRecords(shapes); var builder = project.Templates.ToBuilder(); foreach (var template in import) { builder.Add(template); } var previous = project.Templates; var next = builder.ToImmutable(); _editor.History.Snapshot(previous, next, (p) => project.Templates = p); project.Templates = next; } break; } } catch (Exception ex) { if (_editor.Log != null) { _editor.Log.LogError("{0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace); } } }
private ImportSettings _LoadSettings(XmlNode nodeSettings, ImportType type) { ImportSettings settings = new ImportSettings(); foreach (XmlNode node in nodeSettings.ChildNodes) { if (node.NodeType != XmlNodeType.Element) continue; // skip comments and other non element nodes if (node.Name.Equals(NODE_NAME_SOURCE, StringComparison.OrdinalIgnoreCase)) { if (null != node.FirstChild) settings.Source = node.FirstChild.Value; } else if (node.Name.Equals(NODE_NAME_TABLE, StringComparison.OrdinalIgnoreCase)) settings.TableName = node.Attributes[ATTRIBUTE_NAME_NAME].Value; else if (node.Name.Equals(NODE_NAME_FIELDSMAPPING, StringComparison.OrdinalIgnoreCase)) settings.FieldsMap = _LoadFieldsMap(node, type); } return settings; }
public ImportParam(string fileName, ImportType importType, object[] service) { FileName = fileName; ImportType = importType; Service = service; }
public void Import(string fileName, ImportType importType, object[] service) { /* Thread thread = new Thread(new ParameterizedThreadStart(import)); thread.Start(new ImportParam(fileName, importType, service)); */ InheritedContextAsyncStarter.Run(import, new ImportParam(fileName, importType, service)); }
public static string ImportName(ImportType importType) { string result = ""; switch (importType) { case ImportType.Country: result = "inCountries"; break; case ImportType.Region: result = "inRegions"; break; case ImportType.Store: result = "inStories"; break; case ImportType.World: result = "inWorlds"; break; case ImportType.HWGR: result = "inHWGRs"; break; case ImportType.WGR: result = "inWGRs"; break; case ImportType.WorkingDays: result = "inWorkingDays"; break; case ImportType.Feast: result = "inFeasts"; break; case ImportType.Employee: result = "inEmployee"; break; case ImportType.LongTimeAbsence: result = "inLongTimeAbsence"; break; case ImportType.Absence: result = "inAbsence"; break; case ImportType.TimePlanning: result = "inTimePlanning"; break; case ImportType.TimeRecording: result = "inTimeRecording"; break; case ImportType.ActualBusinessVolume: result = "inActualBusinessVolume"; break; case ImportType.TargetBusinessVolume: result = "inTargetBusinessVolume"; break; case ImportType.CashRegisterReceipt: result = "inCashRegisterReceipt"; break; case ImportType.All: break; default: break; } if (!string.IsNullOrEmpty(result)) { result = Baumax.Localization.Localizer.GetLocalized(result); } return result; }
private void AssignImportStrategy(ImportType importType) { switch (importType) { case ImportType.XML: this.importStrategy = new XmlProductImport(); break; } }
public Import(Dataset dataset, int tableId) : this(dataset) { model.SetParentTableFromId(tableId); this.importType = ImportType.Replace; }
public void Import(ImportType importType) { if (importType == ImportType.All) throw new NotSupported(); if (ImportAllRunning) throw new AnotherImportRunning (); else ImportAllRunning = true; try { log.Info(string.Format(_ImportStartMessage, importType.ToString ())); ImportCompleteWithErrors = false; _CurrImportType = importType; string[] files = GetImportFilesList(_SourceFolder, importType); if (files.Length > 0) { ImportManagerEventsSubscribe(); object[] services = GetServicesArray(importType); try { for (int i = 0; i < files.Length; i++) { ImportFileRunning = true; _ImportManager.Import(files[i], importType, services); while (ImportFileRunning) { Thread.Sleep(1000); } MoveImportedFileIntoFolder(CurrentImportResult, files[i]); } AddTextToImportLog(_ImportSeparatorString, true); if (ImportCompleteWithErrors) { log.Info(string.Format(_ImportCompleteMessage, importType.ToString(),"with error(s).")); throw new ImportCompleteWithErrors(); } else { log.Info(string.Format(_ImportCompleteMessage, importType.ToString(), "successfully.")); } } finally { ImportManagerEventsUnSubscribe(); } } } finally { ImportAllRunning = false; } }
private string[] GetImportFilesList(string sourceFolder, ImportType importType) { string[] files; switch (importType) { case ImportType.CashRegisterReceipt: case ImportType.ActualBusinessVolume: case ImportType.TargetBusinessVolume: files = new string[1]; files[0] = ""; break; default: files = ImportUtil.GetImportFilesList(_SourceFolder, importType); break; } Array.Sort(files, _CIComparer); return files; }
/// <summary> /// Initializes import object(s) name by import type. /// </summary> /// <param name="type">Import type.</param> private void _InitStrings(ImportType type) { string objectsNameRsc = null; string objectNameRsc = null; switch (type) { case ImportType.Orders: objectsNameRsc = "Orders"; objectNameRsc = "Order"; break; case ImportType.Locations: objectsNameRsc = "Locations"; objectNameRsc = "Location"; break; case ImportType.Drivers: objectsNameRsc = "Drivers"; objectNameRsc = "Driver"; break; case ImportType.Vehicles: objectsNameRsc = "Vehicles"; objectNameRsc = "Vehicle"; break; case ImportType.MobileDevices: objectsNameRsc = "MobileDevices"; objectNameRsc = "MobileDevice"; break; case ImportType.DefaultRoutes: objectsNameRsc = "DefaultRoutes"; objectNameRsc = "DefaultRoute"; break; case ImportType.DriverSpecialties: objectsNameRsc = "DriverSpecialties"; objectNameRsc = "DriverSpecialty"; break; case ImportType.VehicleSpecialties: objectsNameRsc = "VehicleSpecialties"; objectNameRsc = "VehicleSpecialty"; break; case ImportType.Barriers: objectsNameRsc = "Barriers"; objectNameRsc = "Barrier"; break; case ImportType.Zones: objectsNameRsc = "Zones"; objectNameRsc = "Zone"; break; default: Debug.Assert(false); // NOTE: not supported type break; } _objectsName = App.Current.FindString(objectsNameRsc); _objectName = App.Current.FindString(objectNameRsc); }
//Generate the imports files. // //Params: //importDir: where to output generated imports //doPragmas, doOverride: should usually be true but specifiy false to make testing easier public static void GenerateDImports(string importDir, bool doPragmas, bool doOverride) { impType = ImportType.Private; List<Assembly> explicitAssemblies = new List<Assembly>(); FileStream fs; try { fs = new FileStream("./assemblylist", FileMode.Open ,FileAccess.Read); } catch(FileNotFoundException) { Console.WriteLine("Could not open the config file"); return; } StreamReader sr = new StreamReader(fs); while (!sr.EndOfStream) { string line = sr.ReadLine(); if (line==null) continue; if (line.StartsWith("//")) continue; try { explicitAssemblies.Add(Assembly.Load(line)); } catch (Exception) { Console.WriteLine("Could not load assembly: " + line); } } List<Assembly> allAssemblies = new List<Assembly>(explicitAssemblies); /* Find all referenced */ foreach (Assembly assembly in explicitAssemblies) { AssemblyName[] referenced = assembly.GetReferencedAssemblies(); foreach(AssemblyName assemname in referenced) { Assembly assem = Assembly.Load(assemname); if (!allAssemblies.Contains(assem)) allAssemblies.Add(assem); } } Console.WriteLine("Loading types from assemblies:\n-------------------------------------"); foreach (Assembly assembly in allAssemblies) { Console.WriteLine(assembly.GetName().Name + "(" + assembly.GetName().Version + ")"); //try //{ Type[] assemtypes = assembly.GetExportedTypes(); foreach (Type type in assemtypes) { if (type.Namespace != null) { NS ns = getCreateNS(type.Namespace); ns.addType(type); } } //} //catch (FileNotFoundException) { } } Console.WriteLine("\n\nCurrent Namespace:\n-------------------------------------"); foreach (NS ns in namespaces) { Thread th = new Thread(new ParameterizedThreadStart(ns.makeFiles)); th.Start(new object[] { importDir, doPragmas, doOverride }); threads.Add(th); } foreach (Thread th in threads) th.Join(); }
public static MultiComponentList ImportFromFile(int index, string FileName, ImportType type) { try { return m_Components[index] = new MultiComponentList(FileName, type); } catch { return m_Components[index] = MultiComponentList.Empty; } }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// private List<FieldMap> _LoadFieldsMap(XmlNode nodeFieldsMap, ImportType type) { StringDictionary mapTitle2Name = PropertyHelpers.GetTitle2NameMap(type); List<FieldMap> fieldsMap = new List<FieldMap>(); foreach (XmlNode node in nodeFieldsMap.ChildNodes) { if (node.NodeType != XmlNodeType.Element) continue; // skip comments and other non element nodes if (node.Name.Equals(NODE_NAME_FIELDSMAP, StringComparison.OrdinalIgnoreCase)) { FieldMap fieldMap = new FieldMap(node.Attributes[ATTRIBUTE_NAME_DSTFIELD].Value, node.Attributes[ATTRIBUTE_NAME_SRCFIELD].Value); if (mapTitle2Name.ContainsValue(fieldMap.ObjectFieldName)) fieldsMap.Add(fieldMap); } } return fieldsMap; }
public static MultiComponentList LoadFromFile(string FileName, ImportType type) { try { return new MultiComponentList(FileName, type); } catch { return MultiComponentList.Empty; } }
/// <summary> /// Import item object from external file. /// </summary> /// <param name="item">The item object to import.</param> /// <param name="type">The type of item object.</param> /// <returns>The await <see cref="Task"/>.</returns> private async Task OnImportObject(object item, ImportType type) { try { if (item != null) { string name = string.Empty; string ext = string.Empty; switch (type) { case ImportType.Style: name = "Style"; ext = "style"; break; case ImportType.Styles: name = "Styles"; ext = "styles"; break; case ImportType.StyleLibrary: name = "StyleLibrary"; ext = "stylelibrary"; break; case ImportType.StyleLibraries: name = "StyleLibraries"; ext = "stylelibraries"; break; case ImportType.Group: name = "Group"; ext = "group"; break; case ImportType.Groups: name = "Groups"; ext = "groups"; break; case ImportType.GroupLibrary: name = "GroupLibrary"; ext = "grouplibrary"; break; case ImportType.GroupLibraries: name = "GroupLibraries"; ext = "grouplibraries"; break; case ImportType.Template: name = "Template"; ext = "template"; break; case ImportType.Templates: name = "Templates"; ext = "templates"; break; } var dlg = new OpenFileDialog(); dlg.AllowMultiple = true; dlg.Filters.Add(new FileDialogFilter() { Name = name, Extensions = { ext } }); dlg.Filters.Add(new FileDialogFilter() { Name = "All", Extensions = { "*" } }); var results = await dlg.ShowAsync(_mainWindow); if (results != null) { foreach (var path in results) { _context.ImportObject(path, item, type); } } } } catch (Exception ex) { if (_context.Editor.Log != null) { _context.Editor.Log.LogError("{0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace); } } }
/// <summary> /// Import item object from external file. /// </summary> /// <param name="item">The item object to import.</param> /// <param name="type">The type of item object.</param> private void OnImportObject(object item, ImportType type) { if (item == null) return; string filter = string.Empty; switch (type) { case ImportType.Style: filter = "Style (*.style)|*.style|All (*.*)|*.*"; break; case ImportType.Styles: filter = "Styles (*.styles)|*.styles|All (*.*)|*.*"; break; case ImportType.StyleLibrary: filter = "StyleLibrary (*.stylelibrary)|*.stylelibrary|All (*.*)|*.*"; break; case ImportType.StyleLibraries: filter = "StyleLibraries (*.styleLibraries)|*.stylelibraries|All (*.*)|*.*"; break; case ImportType.Group: filter = "Group (*.group)|*.group|All (*.*)|*.*"; break; case ImportType.Groups: filter = "Groups (*.groups)|*.groups|All (*.*)|*.*"; break; case ImportType.GroupLibrary: filter = "GroupLibrary (*.grouplibrary)|*.grouplibrary|All (*.*)|*.*"; break; case ImportType.GroupLibraries: filter = "GroupLibraries (*.grouplibraries)|*.grouplibraries|All (*.*)|*.*"; break; case ImportType.Template: filter = "Template (*.template)|*.template|All (*.*)|*.*"; break; case ImportType.Templates: filter = "Templates (*.templates)|*.templates|All (*.*)|*.*"; break; } var dlg = new OpenFileDialog() { Filter = filter, Multiselect = true, FilterIndex = 0 }; if (dlg.ShowDialog(_mainWindow) == true) { var paths = dlg.FileNames; foreach (var path in paths) { _context.ImportObject(path, item, type); } } }
public static List<String> GetImportListOfValues(ImportType importType, String columnName, String additionalFieldName, String ApiToken, String ApiServer) { return Newtonsoft.Json.JsonConvert.DeserializeObject<List<String>>(Factory.GetResponse("ImportExport/GetImportListOfValues", "importType=" + Newtonsoft.Json.JsonConvert.SerializeObject(importType) + "&columnName=" + columnName + "&additionalFieldName=" + additionalFieldName + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); }
private string GetLogFileName(ImportType importType) { return _LogFileNames[(int)importType]; }
/// <summary> /// /// </summary> /// <param name="item"></param> /// <param name="type"></param> private async Task OnImportObject(object item, ImportType type) { if (item != null) { string name = string.Empty; string ext = string.Empty; switch (type) { case ImportType.Style: name = "Style"; ext = "style"; break; case ImportType.Styles: name = "Styles"; ext = "styles"; break; case ImportType.StyleLibrary: name = "StyleLibrary"; ext = "stylelibrary"; break; case ImportType.StyleLibraries: name = "StyleLibraries"; ext = "stylelibraries"; break; case ImportType.Group: name = "Group"; ext = "group"; break; case ImportType.Groups: name = "Groups"; ext = "groups"; break; case ImportType.GroupLibrary: name = "GroupLibrary"; ext = "grouplibrary"; break; case ImportType.GroupLibraries: name = "GroupLibraries"; ext = "grouplibraries"; break; case ImportType.Template: name = "Template"; ext = "template"; break; case ImportType.Templates: name = "Templates"; ext = "templates"; break; } var dlg = new OpenFileDialog(); dlg.AllowMultiple = true; dlg.Filters.Add(new FileDialogFilter() { Name = name, Extensions = { ext } }); dlg.Filters.Add(new FileDialogFilter() { Name = "All", Extensions = { "*" } }); var results = await dlg.ShowAsync(this); if (results != null) { foreach (var path in results) { _context.ImportObject(path, item, type); } } } }
public MongoProductImporter(ImportType importType, string fileName, MongoDatabase database) { this.Database = database; this.AssignImportStrategy(importType); this.products = this.importStrategy.GetProductData(fileName); }