protected override void DoCopy(RoyalGazetteContent iOther)
 {
     if (iOther != null)
     {
         base.DoCopy(iOther);
         if (iOther is RoyalGazetteContentReassign)
         {
             RoyalGazetteContentReassign iOtherReassign = (RoyalGazetteContentReassign)iOther;
             OldGeocode = iOtherReassign.OldGeocode;
             OldParent  = iOtherReassign.OldParent;
         }
     }
 }
Exemple #2
0
        protected override void ProcessContent(RoyalGazetteContent iContent)
        {
            base.ProcessContent(iContent);
            RoyalGazetteContentCreate lCreate = (RoyalGazetteContentCreate)iContent;

            Int32 lParentGeocode = lCreate.Geocode / 100;

            if (!mCreationsPerParent.ContainsKey(lParentGeocode))
            {
                mCreationsPerParent.Add(lParentGeocode, 0);
            }
            mCreationsPerParent[lParentGeocode]++;

            Int32        lMaxSubEntityIndex = 0;
            List <Int32> lParentEntities    = new List <Int32>();

            foreach (RoyalGazetteContent lSubEntry in lCreate.SubEntries)
            {
                if (lSubEntry is RoyalGazetteContentCreate)
                {
                    lMaxSubEntityIndex++;
                }
                if (lSubEntry is RoyalGazetteContentReassign)
                {
                    lMaxSubEntityIndex++;

                    RoyalGazetteContentReassign lReassign = (RoyalGazetteContentReassign)lSubEntry;
                    Int32 lParentEntityCode = lReassign.OldGeocode / 100;
                    if (!lParentEntities.Contains(lParentEntityCode))
                    {
                        lParentEntities.Add(lParentEntityCode);
                    }
                }
            }

            mNumberOfSubEntities.IncrementForCount(lMaxSubEntityIndex, lCreate.Geocode);
            if (lParentEntities.Any())
            {
                mNumberOfParentEntities.IncrementForCount(lParentEntities.Count, lCreate.Geocode);
            }
        }
Exemple #3
0
 internal override void DoLoad(XmlNode iNode)
 {
     base.DoLoad(iNode);
     if (iNode != null && iNode.Name.Equals(XmlLabel))
     {
         String s = TambonHelper.GetAttributeOptionalString(iNode, "type");
         if (!String.IsNullOrEmpty(s))
         {
             Status = (EntityType)Enum.Parse(typeof(EntityType), s);
         }
         NewParent = TambonHelper.GetAttributeOptionalInt(iNode, "parent", 0);
         foreach (XmlNode lNode in iNode.ChildNodes)
         {
             if (lNode.Name == RoyalGazetteContentReassign.XmlLabel)
             {
                 var lContent = new RoyalGazetteContentReassign();
                 lContent.DoLoad(lNode);
                 mSubEntries.Add(lContent);
             }
         }
     }
 }
        protected override void ProcessContent(RoyalGazetteContent iContent)
        {
            base.ProcessContent(iContent);
            RoyalGazetteContentCreate lCreate = (RoyalGazetteContentCreate)iContent;

            List <Int32> lTargetMubanNumbers = new List <Int32>();

            foreach (RoyalGazetteContent lSubEntry in lCreate.SubEntries)
            {
                if (lSubEntry is RoyalGazetteContentReassign)
                {
                    RoyalGazetteContentReassign lReassign = (RoyalGazetteContentReassign)lSubEntry;
                    Int32 lTargetMubanCode = lSubEntry.Geocode % 100;
                    if (lTargetMubanCode == 0)
                    {
                    }
                    else if (lTargetMubanNumbers.Contains(lTargetMubanCode))
                    {
                        ;  // This should no happen, probably mistake in XML
                    }
                    else
                    {
                        lTargetMubanNumbers.Add(lTargetMubanCode);
                    }
                    Int32 lOldMubanCode = lReassign.OldGeocode % 100;
                    if ((lTargetMubanCode != 0) & (lOldMubanCode != 0))
                    {
                        if (lTargetMubanCode == lOldMubanCode)
                        {
                            mMubanNumberEqual++;
                        }
                        else
                        {
                            mMubanNumberChanged++;
                        }
                    }
                }
            }
        }
Exemple #5
0
        static internal RoyalGazetteContent CreateContentObject(String iName)
        {
            RoyalGazetteContent retval = null;

            switch (iName)
            {
            case RoyalGazetteContentRename.XmlLabel:
            {
                retval = new RoyalGazetteContentRename();
                break;
            }

            case RoyalGazetteContentStatus.XmlLabel:
            {
                retval = new RoyalGazetteContentStatus();
                break;
            }

            case RoyalGazetteContentCreate.XmlLabel:
            {
                retval = new RoyalGazetteContentCreate();
                break;
            }

            case RoyalGazetteContentAreaChange.XmlLabel:
            {
                retval = new RoyalGazetteContentAreaChange();
                break;
            }

            case RoyalGazetteContentAreaDefinition.XmlLabel:
            {
                retval = new RoyalGazetteContentAreaDefinition();
                break;
            }

            case RoyalGazetteContentReassign.XmlLabel:
            {
                retval = new RoyalGazetteContentReassign();
                break;
            }

            case RoyalGazetteContentAbolish.XmlLabel:
            {
                retval = new RoyalGazetteContentAbolish();
                break;
            }

            case RoyalGazetteContentConstituency.XmlLabel:
            {
                retval = new RoyalGazetteContentConstituency();
                break;
            }

            case RoyalGazetteContentMention.XmlLabel:
            {
                retval = new RoyalGazetteContentMention();
                break;
            }

            case RoyalGazetteContentCapital.XmlLabel:
            {
                retval = new RoyalGazetteContentCapital();
                break;
            }
            }
            return(retval);
        }