Exemplo n.º 1
0
        private static void HandleQuitClain(Action <string> callback, string fixedRow, string EventName, ref DateTime DateVal)
        {
            var EventSplit = fixedRow.IndexOf("by");
            var CleanedRow = "";

            if (EventSplit != -1)
            {
                EventName  = fixedRow.Substring(0, EventSplit).Trim();
                CleanedRow = fixedRow.Replace(EventName + " by", "");
            }
            else
            {
                EventSplit = fixedRow.IndexOf("to");
                EventName  = fixedRow.Substring(0, EventSplit);
                CleanedRow = fixedRow.Replace(EventName, " ");
            }

            var clients = DataExtraction.BaseClientExtractor(CleanedRow);

            SpecialStructs.Globals.globalDeptor = clients[0];
            var ClientTwo = clients[1];

            ClientTwo = ClientTwo.Substring(0, DataExtraction.FindAbbMonthOrNumber(ClientTwo)).Trim().TrimEnd(',');
            SpecialStructs.Globals.globalPurchaserID = DataInsertion.InsertPurchaser(ClientTwo);
            DateVal = DataExtraction.ExtractDateField(clients[1].Replace(ClientTwo, ""), callback);
            Console.WriteLine();
        }
Exemplo n.º 2
0
        private static void EventData(string textRow, Action <string> callback)
        {
            var fixedRow      = DataExtraction.textRowWithoutNotes(textRow.Trim());
            var fixedRowLower = fixedRow.ToLower();
            var DateVal       = DateTime.MinValue;
            var EventName     = "";

            if (fixedRowLower.StartsWith(EventTypes.Quitclaim))
            {
                HandleQuitClain(callback, fixedRow, EventName, ref DateVal);
            }
            else if (fixedRowLower.StartsWith(EventTypes.FinalCertif))
            {
                EventName = "Final Certificate";
                var SimplifiedRow = fixedRow.Replace(EventName + ",", "");
                SimplifiedRow = SimplifiedRow.Replace(EventTypes.FinalCertif, "");
                DateVal       = DataExtraction.ExtractDateField(SimplifiedRow, callback);
            }
            else if (fixedRowLower.StartsWith(EventTypes.SEEBits))
            {
                EventName = "SEE:";
                var SimplifiedRow = fixedRow.Replace(EventName, "");
                DataExtraction.GetNotes(SimplifiedRow).Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach(SpecialStructs.Globals.globalNotes.Add);
            }
            else if (fixedRowLower.StartsWith(EventTypes.NOTEBits))
            {
                EventName = "NOTE:";
                var SimplifiedRow = fixedRow.Replace(EventName, "");
                SpecialStructs.Globals.globalNotes.Add(SimplifiedRow);
            }
            else
            {
                EventName = DataExtraction.textRowWithoutNotes(fixedRow);
                EventName = EventName.Split(',')[0].Trim();
                var TEventName = ApplicationConfiguration.KnownValidEvents.Find(item =>
                                                                                Utils.TryToFixSpelling(item, EventName));
                if (TEventName != null)
                {
                    EventName = TEventName;
                }

                if (EventName.Length == 1)
                {
                    EventName = "";
                }

                var SimplifiedRow = fixedRow.Replace(EventName + ",", "");
                //tax like options
                if (ApplicationConfiguration.TaxLikeOption.Any(s => s == EventName))
                {
                    var clients = DataExtraction.ExtractClientsTax(SimplifiedRow);
                    if (clients.Count == 2)
                    {
                        SpecialStructs.Globals.globalDeptor      = clients[0];
                        SpecialStructs.Globals.globalPurchaserID = DataInsertion.InsertPurchaser(clients[1]);
                    }
                    else if (clients.Count == 1)
                    {
                        SpecialStructs.Globals.globalDeptor      = "";
                        SpecialStructs.Globals.globalPurchaserID = DataInsertion.InsertPurchaser(clients[0]);
                        callback($"The code was unable to find both clients please check the line for missing `to` also please check the tblPurchaser table id {SpecialStructs.Globals.globalPurchaserID} for what was extracted for manual fixing");
                    }
                    else
                    {
                        callback("The code was unable to find both clients please check the line for missing `to`");
                    }
                }
                if (!ApplicationConfiguration.SpecialNonHeaderLines.Any(textRow.Contains))
                {
                    DateVal = DataExtraction.ExtractDateField(SimplifiedRow, callback);
                }

                if (fixedRowLower.StartsWith(EventTypes.REDEMPT))
                {
                    EventName = "NO REDEMPTION FOUND REGISTERED.";
                }
            }
            SpecialStructs.Globals.globalEventID = DataInsertion.InsertEventType(new EventType {
                EventAbb = SpecialStructs.Globals.EventAbb, EventTypeName = EventName
            });
            SpecialStructs.Globals.globalDate = DateVal;
        }