Example #1
0
        internal static EntityLeader Load(XmlNode node)
        {
            EntityLeader result = null;

            if (node != null && node.Name.Equals("official"))
            {
                result           = new EntityLeader();
                result.Name      = TambonHelper.GetAttribute(node, "name");
                result.English   = TambonHelper.GetAttributeOptionalString(node, "english");
                result.Telephone = TambonHelper.GetAttributeOptionalString(node, "telephone");
                result.CellPhone = TambonHelper.GetAttributeOptionalString(node, "cellphone");
                result.Comment   = TambonHelper.GetAttributeOptionalString(node, "comment");

                result.BeginOfTermYear = TambonHelper.GetAttributeOptionalInt(node, "beginyear", 0);
                result.EndOfTermYear   = TambonHelper.GetAttributeOptionalInt(node, "endyear", 0);
                result.Index           = TambonHelper.GetAttributeOptionalInt(node, "index", 0);
                result.BeginOfTerm     = TambonHelper.GetAttributeOptionalDateTime(node, "begin");
                result.EndOfTerm       = TambonHelper.GetAttributeOptionalDateTime(node, "end");

                String position = TambonHelper.GetAttribute(node, "title");
                result.Position = (EntityLeaderType)Enum.Parse(typeof(EntityLeaderType), position);

                String personTitle = TambonHelper.GetAttributeOptionalString(node, "nametitle");
                if (!String.IsNullOrEmpty(personTitle))
                {
                    result.Title = (PersonTitle)Enum.Parse(typeof(PersonTitle), position);
                }
            }
            return(result);
        }
Example #2
0
 public EntityLeader(EntityLeader value)
 {
     Name            = value.Name;
     English         = value.English;
     Title           = value.Title;
     Telephone       = value.Telephone;
     CellPhone       = value.CellPhone;
     Position        = value.Position;
     Index           = value.Index;
     BeginOfTerm     = value.BeginOfTerm;
     BeginOfTermYear = value.BeginOfTermYear;
     EndOfTerm       = value.EndOfTerm;
     EndOfTermYear   = value.EndOfTermYear;
 }
Example #3
0
 public EntityLeader(EntityLeader value)
 {
     Name = value.Name;
     English = value.English;
     Title = value.Title;
     Telephone = value.Telephone;
     CellPhone = value.CellPhone;
     Position = value.Position;
     Index = value.Index;
     BeginOfTerm = value.BeginOfTerm;
     BeginOfTermYear = value.BeginOfTermYear;
     EndOfTerm = value.EndOfTerm;
     EndOfTermYear = value.EndOfTermYear;
 }
Example #4
0
        public Boolean LeaderAlreadyInList(EntityLeader iLeader)
        {
            Boolean RetVal = false;

            foreach (EntityOffice lOffice in Offices)
            {
                if (lOffice.OfficialsList != null)
                {
                    foreach (EntityLeader lLeader in lOffice.OfficialsList)
                    {
                        RetVal = RetVal | ((lLeader.Name == iLeader.Name) && (lLeader.Position == iLeader.Position));
                    }
                }
            }
            return(RetVal);
        }
Example #5
0
        private List <EntityLeader> ParseNames(String iLine, EntityLeaderType iPosition)
        {
            List <EntityLeader> lResult = new List <EntityLeader>();
            // to split the string into lines with one leader data
            String lLine = iLine.Replace("<BR>", Environment.NewLine).Replace("</P>", Environment.NewLine);

            lLine = RemoveAllTags(lLine);
            StringReader lReader      = new StringReader(lLine);
            String       lCurrentLine = String.Empty;

            while ((lCurrentLine = lReader.ReadLine()) != null)
            {
                EntityLeader lCurrentEntry = new EntityLeader();
                lCurrentEntry.Position = iPosition;
                Int32 lPos1 = lCurrentLine.IndexOf(mTelephoneStart);
                Int32 lPos2 = lCurrentLine.IndexOf(mMobileStart);
                if (lPos2 >= 0)
                {
                    String lNumber = lCurrentLine.Substring(lPos2 + mMobileStart.Length).Trim();
                    // very last entry has text after the number
                    if (lNumber.Contains(' '))
                    {
                        lNumber = lNumber.Substring(0, lNumber.IndexOf(' '));
                    }
                    lCurrentEntry.CellPhone = lNumber;
                    lCurrentLine            = lCurrentLine.Substring(0, lPos2);
                }
                if (lPos1 >= 0)
                {
                    lCurrentEntry.Telephone = lCurrentLine.Substring(lPos1 + mTelephoneStart.Length).Trim();
                    lCurrentLine            = lCurrentLine.Substring(0, lPos1);
                }
                lCurrentEntry.Name = lCurrentLine.Trim();
                // The name may have more than whitespace in the middle
                while (lCurrentEntry.Name.Contains("  "))
                {
                    lCurrentEntry.Name = lCurrentEntry.Name.Replace("  ", " ");
                }
                if (!String.IsNullOrEmpty(lCurrentEntry.Name))
                {
                    lResult.Add(lCurrentEntry);
                }
            }
            return(lResult);
        }
 private List<EntityLeader> ParseNames(String iLine, EntityLeaderType iPosition)
 {
     List<EntityLeader> lResult = new List<EntityLeader>();
     // to split the string into lines with one leader data
     String lLine = iLine.Replace("<BR>", Environment.NewLine).Replace("</P>", Environment.NewLine);
     lLine = RemoveAllTags(lLine);
     StringReader lReader = new StringReader(lLine);
     String lCurrentLine = String.Empty;
     while ((lCurrentLine = lReader.ReadLine()) != null)
     {
         EntityLeader lCurrentEntry = new EntityLeader();
         lCurrentEntry.Position = iPosition;
         Int32 lPos1 = lCurrentLine.IndexOf(mTelephoneStart);
         Int32 lPos2 = lCurrentLine.IndexOf(mMobileStart);
         if (lPos2 >= 0)
         {
             String lNumber = lCurrentLine.Substring(lPos2 + mMobileStart.Length).Trim();
             // very last entry has text after the number
             if (lNumber.Contains(' '))
             {
                 lNumber = lNumber.Substring(0, lNumber.IndexOf(' '));
             }
             lCurrentEntry.CellPhone = lNumber;
             lCurrentLine = lCurrentLine.Substring(0, lPos2);
         }
         if (lPos1 >= 0)
         {
             lCurrentEntry.Telephone = lCurrentLine.Substring(lPos1 + mTelephoneStart.Length).Trim();
             lCurrentLine = lCurrentLine.Substring(0, lPos1);
         }
         lCurrentEntry.Name = lCurrentLine.Trim();
         // The name may have more than whitespace in the middle
         while (lCurrentEntry.Name.Contains("  "))
         {
             lCurrentEntry.Name = lCurrentEntry.Name.Replace("  ", " ");
         }
         if (!String.IsNullOrEmpty(lCurrentEntry.Name))
         {
             lResult.Add(lCurrentEntry);
         }
     }
     return lResult;
 }
 public Boolean LeaderAlreadyInList(EntityLeader iLeader)
 {
     Boolean RetVal = false;
     foreach ( EntityOffice lOffice in Offices )
     {
         if ( lOffice.OfficialsList != null )
         {
             foreach ( EntityLeader lLeader in lOffice.OfficialsList )
             {
                 RetVal = RetVal | ((lLeader.Name == iLeader.Name) && (lLeader.Position == iLeader.Position));
             }
         }
     }
     return RetVal;
 }
Example #8
0
        internal static EntityLeader Load(XmlNode node)
        {
            EntityLeader result = null;

            if ( node != null && node.Name.Equals("official") )
            {
                result = new EntityLeader();
                result.Name = TambonHelper.GetAttribute(node, "name");
                result.English = TambonHelper.GetAttributeOptionalString(node, "english");
                result.Telephone = TambonHelper.GetAttributeOptionalString(node, "telephone");
                result.CellPhone = TambonHelper.GetAttributeOptionalString(node, "cellphone");
                result.Comment = TambonHelper.GetAttributeOptionalString(node, "comment");

                result.BeginOfTermYear = TambonHelper.GetAttributeOptionalInt(node, "beginyear", 0);
                result.EndOfTermYear = TambonHelper.GetAttributeOptionalInt(node, "endyear", 0);
                result.Index = TambonHelper.GetAttributeOptionalInt(node, "index", 0);
                result.BeginOfTerm = TambonHelper.GetAttributeOptionalDateTime(node, "begin");
                result.EndOfTerm = TambonHelper.GetAttributeOptionalDateTime(node, "end");

                String position = TambonHelper.GetAttribute(node, "title");
                result.Position = (EntityLeaderType)Enum.Parse(typeof(EntityLeaderType), position);

                String personTitle = TambonHelper.GetAttributeOptionalString(node, "nametitle");
                if ( !String.IsNullOrEmpty(personTitle) )
                {
                    result.Title = (PersonTitle)Enum.Parse(typeof(PersonTitle), position);
                }
            }
            return result;
        }