Exemplo n.º 1
0
        private static void AddPayment(MergeBlock block, string payType, double payValue, string payCurrency, XElement xmlPayment)
        {
            int npy = block.Payments != null?block.Payments.Count() : 0;

            Payment py = new Payment();

            py.PayType     = payType;
            py.PayValue    = payValue;
            py.PayCurrency = payCurrency;
            MergeBlock.AddPayment(block, py);
        }
Exemplo n.º 2
0
 public static void AddToDo(MergeBlock mb, ToDo ps)
 {
     if (mb.ToDos == null)
     {
         List <ToDo> tds = new List <ToDo>();
         tds.Add(ps);
         mb.ToDos = tds;
     }
     else
     {
         mb.ToDos.Add(ps);
     }
 }
Exemplo n.º 3
0
 public static void AddPayment(MergeBlock mb, Payment ps)
 {
     if (mb.Payments == null)
     {
         List <Payment> pays = new List <Payment>();
         pays.Add(ps);
         mb.Payments = pays;
     }
     else
     {
         mb.Payments.Add(ps);
     }
 }
Exemplo n.º 4
0
 public static void AddPerson(MergeBlock mb, Person ps)
 {
     if (mb.Persons == null)
     {
         List <Person> psns = new List <Person>();
         psns.Add(ps);
         mb.Persons = psns;
     }
     else
     {
         mb.Persons.Add(ps);
     }
 }
Exemplo n.º 5
0
 public static void AddPersonToDo(MergeBlock mb, int personIdx, ToDo ps)
 {
     if (mb.Persons[personIdx].ToDos == null)
     {
         List <ToDo> tds = new List <ToDo>();
         tds.Add(ps);
         mb.Persons[personIdx].ToDos = tds;
     }
     else
     {
         mb.Persons[personIdx].ToDos.Add(ps);
     }
 }
Exemplo n.º 6
0
        private static void AddToDo(MergeBlock secBlock, string actionReq, string primaryChunkId,
                                    string primaryTag, string secondaryTag)
        {
            int np = secBlock.ToDos != null?secBlock.ToDos.Count() : 0;

            ToDo td = new ToDo();

            td.ActionReq      = actionReq;
            td.PrimaryChunkId = primaryChunkId;
            td.PrimaryTag     = primaryTag;
            td.SecondaryTag   = secondaryTag;
            td.Log            = string.Empty;
            td.doneRef        = 0;
            MergeBlock.AddToDo(secBlock, td);
        }
Exemplo n.º 7
0
        private static void AddPerson(MergeBlock block, string holderOrSubtantialOwner, string orgOrIndividual, string personId, string birthDate, string scv, string fullName, XElement xmlPerson)
        {
            int np = block.Persons != null?block.Persons.Count() : 0;

            Person mp = new Person();

            mp.HolderOrSubtantialOwner = holderOrSubtantialOwner;
            mp.OrgOrIndividual         = orgOrIndividual;
            mp.PersonId  = personId;
            mp.SCV       = scv;
            mp.FullName  = fullName;
            mp.XmlPerson = xmlPerson;
            mp.BirthDate = birthDate;
            MergeBlock.AddPerson(block, mp);
        }
Exemplo n.º 8
0
        private void ExtractPeople(HotTag tags, MergeBlock block, string holderOrSubtantialOwner, List <XElement> ahPerson)
        {
            string   orgOrIndividual = string.Empty;
            string   personId = string.Empty;
            string   birthDate = string.Empty;
            string   scv = string.Empty;
            string   fullName = string.Empty;
            string   firstName, middleName, lastName = string.Empty;
            XElement xmlPerson = new XElement("dummy", "dummy");

            foreach (var item in ahPerson)
            {
                if (item.HasElements)
                {
                    orgOrIndividual = item.Element(ns + tags.tagOrganisation) != null ? tags.tagOrganisation : tags.tagIndividual;
                    foreach (XElement p in item.Descendants(ns + orgOrIndividual))
                    {
                        personId = p.Element(sfa + tags.tagIndID) != null?p.Element(sfa + tags.tagIndID).Value.ToString() : "";

                        var bd = p.Descendants(sfa + "BirthInfo").Descendants(sfa + "BirthDate").Select(s => s.Value).FirstOrDefault();
                        birthDate = bd != null?bd.ToString() : "";

                        var nm = p.Descendants(sfa + "Name").FirstOrDefault();
                        if (orgOrIndividual == tags.tagOrganisation)
                        {
                            fullName = p.Element(sfa + "Name") != null?p.Element(sfa + "Name").Value.ToString().Trim() : "";
                        }
                        else
                        {
                            firstName = nm.Element(sfa + "FirstName") != null?nm.Element(sfa + "FirstName").Value.ToString() : "";

                            middleName = nm.Element(sfa + "MiddleName") != null?nm.Element(sfa + "MiddleName").Value.ToString() : "";

                            lastName = nm.Element(sfa + "LastName") != null?nm.Element(sfa + "LastName").Value.ToString() : "";

                            fullName = (lastName + "," + firstName + " " + middleName).Trim();
                        }
                        xmlPerson = p;
                        break;
                    }
                    //personId = person.Element(sfa + tags.tagIndID)[0] != null ? person.Element(sfa + tags.tagIndID)[0].Value.ToString() : "";
                    if (personId != "")
                    {
                        AddPerson(block, holderOrSubtantialOwner, orgOrIndividual, personId, birthDate, scv, fullName, xmlPerson);
                    }
                }
            }
        }
Exemplo n.º 9
0
        private void ExtractPayments(HotTag tags, MergeBlock block, List <XElement> payments)
        {
            string payType   = string.Empty;
            string spayValue = string.Empty;
            double payValue;
            string payCurrency = string.Empty;

            XElement xmlPayment = new XElement("dummy", "dummy");

            foreach (var p in payments)
            {
                if (p.HasElements)
                {
                    //orgOrIndividual = item.Element(ns + tags.tagOrganisation) != null ? tags.tagOrganisation : tags.tagIndividual;
                    //foreach (XElement p in item.Descendants(ns + orgOrIndividual))
                    //{
                    payType = p.Element(ns + tags.tagPayType) != null?p.Element(ns + tags.tagPayType).Value.ToString() : "";

                    spayValue = p.Element(ns + tags.tagPayAmount) != null?p.Element(ns + tags.tagPayAmount).Value : "";

                    try
                    {
                        payValue = Convert.ToDouble(spayValue);
                    }
                    catch (Exception)
                    {
                        errorLog = errorLog + "\n" + "Invalid Payment Amount:" + spayValue +
                                   payments.ToString() + "\n";
                        return;
                    }
                    var fred   = p.Element(ns + tags.tagPayAmount);
                    var barney = fred.Attribute(tags.tagAccBalCurrAtt);

                    payCurrency = p.Element(ns + tags.tagPayAmount).Attribute(tags.tagAccBalCurrAtt) != null?
                                  p.Element(ns + tags.tagPayAmount).Attribute(tags.tagAccBalCurrAtt).Value : "";

                    AddPayment(block, payType, payValue, payCurrency, xmlPayment);
                }
            }
        }
Exemplo n.º 10
0
 private void MarkMatchedSecondaryPeople(HotTag tags, List <MergeBlock> priBlockList, List <MergeBlock> secBlockList)
 {
     foreach (MergeBlock pb in priBlockList)
     {
         string secAcc;
         if (!mapPriToSec.TryGetValue(pb.ClientId, out secAcc))
         {
             continue;
         }
         else
         {
             MergeBlock sb = GetMergeBlock(secBlockList, secAcc);
             foreach (Person pbp in pb.Persons)
             {
                 if (sb != null)
                 {
                     MarkTheMatches(tags, pb, pbp, sb);
                 }
             }
         }
     }
 }
Exemplo n.º 11
0
 private static void MarkTheMatches(HotTag tags, MergeBlock pb, Person pbp, MergeBlock sb)
 {
     foreach (Person sbp in sb.Persons)
     {
         // skip to next iteration if already matched
         if ((sbp.ExistsInPrimaryBlockId > 0) || (sbp.OrgOrIndividual == tags.tagOrganisation))
         {
             continue;
         }
         else
         {
             // check for a match
             if (sbp.PersonId == pbp.PersonId && sbp.FullName == pbp.FullName)
             {
                 sbp.ExistsInPrimaryBlockId = pb.BlockId;
             }
             if (sbp.FullName == pbp.FullName)
             {
                 sbp.ExistsInPrimaryBlockId = pb.BlockId;
             }
         }
     }
 }
Exemplo n.º 12
0
 private void PrepUnmatchedSecondaryPeople(HotTag tags, List <MergeBlock> priBlockList, List <MergeBlock> secBlockList)
 {
     foreach (MergeBlock sb in secBlockList)
     {
         string priAcc;
         if (!mapSecToPri.TryGetValue(sb.ClientId, out priAcc))
         {
             continue;
         }
         else
         {
             MergeBlock pb        = GetMergeBlock(priBlockList, priAcc);
             int        personIdx = 0;
             foreach (Person sbp in sb.Persons)
             {
                 if (sbp.ExistsInPrimaryBlockId == 0)
                 {
                     // Add ToDo to the secondary person : Action append Person to Primary Client
                     int np = sb.Persons[personIdx].ToDos != null ? sb.Persons[personIdx].ToDos.Count() : 0;
                     if (np == 0)
                     {
                         ToDo td = new ToDo();
                         td.ActionReq      = "AddPerson";
                         td.PrimaryChunkId = pb.ClientId;
                         td.PrimaryTag     = tags.tagIndividual;
                         td.SecondaryTag   = string.Empty;
                         td.Log            = string.Empty;
                         td.doneRef        = 0;
                         MergeBlock.AddPersonToDo(sb, personIdx, td);
                     }
                 }
                 personIdx++;
             }
             //AddToDoForThoseWeNeedToAdd(tags, pb, sb);
         }
     }
 }