public void TestImportFamily() { string testFile = TAppSettingsManager.GetValue("ExtractTest.file", "../../csharp/ICT/Testing/lib/MPartner/SampleData/sampleExtract.ext"); string SelectedEventCode = TAppSettingsManager.GetValue("ImportPartnerForEventCode", String.Empty); StreamReader reader = new StreamReader(testFile, System.Text.Encoding.GetEncoding(1252)); string[] lines = reader.ReadToEnd().Replace("\r\n", "\n").Replace("\r", "\n").Split(new char[] { '\n' }); reader.Close(); TVerificationResultCollection VerificationResult; TPartnerFileImport importer = new TPartnerFileImport(); PartnerImportExportTDS MainDS = importer.ImportAllData(lines, SelectedEventCode, false, out VerificationResult); CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResult); foreach (PPartnerRow PartnerRow in MainDS.PPartner.Rows) { TLogging.Log(PartnerRow.PartnerKey.ToString() + " " + PartnerRow.PartnerShortName); } // TODO: check if the partners have been imported previously already foreach (PPartnerRow PartnerRow in MainDS.PPartner.Rows) { TLogging.Log(PartnerRow.PartnerKey.ToString() + " " + PartnerRow.PartnerShortName); } try { PartnerImportExportTDSAccess.SubmitChanges(MainDS); } catch (Exception e) { TLogging.Log(e.Message); TLogging.Log(e.StackTrace); Assert.Fail("See log messages"); } Assert.AreEqual(2, MainDS.PPartner.Rows.Count); }
public static PartnerImportExportTDS ImportFromPartnerExtract(string[] ATextFileLines, out TVerificationResultCollection AVerificationResult) { TPartnerFileImport Importer = new TPartnerFileImport(); PartnerImportExportTDS MainDS = Importer.ImportAllData(ATextFileLines, string.Empty, false, out AVerificationResult); return MainDS; }
public static Boolean ImportDataExt(string[] ALinesToImport, string ALimitToOption, bool ADoNotOverwrite, out TVerificationResultCollection AResultList) { TPartnerFileImport Importer = new TPartnerFileImport(); Importer.ImportAllData(ALinesToImport, ALimitToOption, ADoNotOverwrite, out AResultList); return true; }