示例#1
0
        private static void ViewMapping(MergeProfile mp)
        {
            Console.WriteLine("\nAvaloq to HP Mappings\n");

            foreach (var avqToHP in mp.mapPriToSec)
            {
                Console.WriteLine("AvqRef={0} HPRef={1}", avqToHP.Key.PadLeft(10), avqToHP.Value.PadLeft(10));
            }

            Console.WriteLine("\nHP to Avaloq Mappings\n");

            foreach (var hpToAvq in mp.mapSecToPri)
            {
                Console.WriteLine("HPRef={0} AvqRef={1}", hpToAvq.Key.PadLeft(10), hpToAvq.Value.PadLeft(10));
            }
            Console.WriteLine("\nhit Spacebar for menu");
        }
示例#2
0
        // HotTags to navigate each type of xml

        static void Main(string[] args)
        {
            // Set up new merge profile
            MergeProfile mp = new MergeProfile();

            mp.SetState("new");


            // Load the Primary xml (master) and the Secondary xml and csv with the to/from identifiers
            var directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            mp.filePrimary   = Path.Combine(directory, "xmlValidate", @"SWI_US_AV.xml");
            mp.fileSecondary = Path.Combine(directory, "xmlValidate", @"SWI_US_HP.xml");
            mp.fileMapping   = Path.Combine(directory, "xmlValidate", @"SWI_US_MapAvqFirst.csv");
            mp.fileMerged    = Path.Combine(directory, "xmlValidate", @"SWI_US_AV_Merged.xml");
            mp.xPrimary      = XDocument.Load(mp.filePrimary);
            mp.xSecondary    = XDocument.Load(mp.fileSecondary);
            mp.mapPriToSec   = new Dictionary <string, string>();
            mp.mapSecToPri   = new Dictionary <string, string>();
            mp.fileType      = "SWIUS";
            //try
            //{
            //    dsMerge myds = new dsMerge();
            //    myds.Test(mp.filePrimary.ToString(), mp.fileSecondary.ToString());
            //}
            //catch (Exception)
            //{

            //    throw;
            //}

            try
            {
                mp.ReadMappings();
            }
            catch (Exception)
            {
                throw;
            }

            XDocument xmlLegacyOnlyAccs = new XDocument();

            //xmlAvaloq.Save(mp.filePrimary);
            //xmlLegacy.Save(mp.fileSecondary);

            // Set up xml naigation name
            HotTag htSWIUS = new HotTag();

            htSWIUS.tagReportingGroup   = "ReportingGroup";
            htSWIUS.tagAccBlock         = "AccountReport";
            htSWIUS.tagAccID            = "AccountNumber";
            htSWIUS.tagIndBlockowner    = "AccountHolder";
            htSWIUS.tagIndBlocksubowner = "SubstantialOwner";
            htSWIUS.tagIndID            = "TIN";
            htSWIUS.tagAccBalance       = "AccountBalance";
            htSWIUS.tagAccBalCurrAtt    = "currCode";
            htSWIUS.tagOrganisation     = "Organisation";
            htSWIUS.tagIndividual       = "Individual";
            htSWIUS.tagPayment          = "Payment";
            htSWIUS.tagPayType          = "Type";
            htSWIUS.tagPayAmount        = "PaymentAmnt";
            htSWIUS.tagPayCurrAttr      = "currCode";


            // Read all the identifiers in both xmls
            try
            {
                mp.ReadIdentifiers(htSWIUS);
            }
            catch (Exception)
            {
                throw;
            }
            // Create a list of Secondary clients that exist in the Primary
            try
            {
                mp.AssessSecondaryClients();
            }
            catch (Exception)
            {
                throw;
            }

            // Create Primary Client Blocks
            try
            {
                mp.MakeChunks(htSWIUS);
            }
            catch (Exception)
            {
                throw;
            }

            // Merge secondary chunks into Primary
            try
            {
                mp.MergeIntoPrimary(htSWIUS);
            }
            catch (Exception)
            {
                throw;
            }

            // Merge secondary chunks into Primary
            try
            {
                mp.SavedMergedFile(htSWIUS);
                Console.WriteLine("\n Merged Results Saved to {0}", mp.fileMerged);
            }
            catch (Exception)
            {
                throw;
            }
            // Create Secondary Client Blocks

            // Present Menu
            ShowMenu();
            ConsoleKeyInfo cki;

            do
            {
                cki = Console.ReadKey();
                string option = cki.Key.ToString().Tail(1);

                switch (option)
                {
                case "r":      //SpaceBa[r]
                    ShowMenu();
                    break;

                case "1":
                    //Viewxml(xmlAvaloq, htSWIUS);
                    Console.WriteLine(mp.xPrimary);
                    Console.WriteLine("\nList of Accounts:\n");
                    foreach (string client in mp.priClientIds)
                    {
                        Console.WriteLine(client);
                    }
                    Console.WriteLine(" ");
                    foreach (string person in mp.priPersonIds)
                    {
                        Console.WriteLine(person);
                    }

                    Console.WriteLine("\nhit Spacebar for menu");
                    break;

                case "2":
                    //Viewxml(xmlLegacy,htSWIUS);
                    Console.WriteLine(mp.xSecondary);
                    Console.WriteLine("\nList of Accounts:\n");
                    foreach (string client in mp.secClientIds)
                    {
                        Console.WriteLine(client);
                    }
                    Console.WriteLine(" ");
                    foreach (string person in mp.secPersonIds)
                    {
                        Console.WriteLine(person);
                    }

                    Console.WriteLine("\nhit Spacebar for menu");
                    break;

                case "3":
                    ViewMapping(mp);
                    break;

                case "4":
                    ShowMatches(mp.xSecondary, htSWIUS, mp.mapSecToPri);
                    break;

                default:
                    break;
                }
            } while (cki.Key != ConsoleKey.Escape);
        }