Exemple #1
0
        /// <summary>
        // Get Alias from LoginName
        /// </summary>
        /// <param name="kpUser"></param>
        private static void GetAliasFromLoginName(KPUser kpUser)
        {
            // Get Alias from LoginName
            int index = kpUser.LoginName.IndexOf(@"ANT\", StringComparison.CurrentCultureIgnoreCase);

            if (index > -1)
            {
                kpUser.Alias = kpUser.LoginName.Substring(index + 4);
            }
        }
Exemple #2
0
 /// <summary>
 // Ensure email exists
 /// </summary>
 /// <param name="kpUser"></param>
 private static void EnsureEmail(KPUser kpUser)
 {
     // Ensure email exists
     if (string.IsNullOrEmpty(kpUser.Email)) // No email but Alias is present
     {
         if (!string.IsNullOrEmpty(kpUser.Alias))
         {
             kpUser.Email = kpUser.Alias + "@amazon.com";
         }
     }
     else
     if (string.IsNullOrEmpty(kpUser.Alias))     // If Email is present, but login name missing
     {
         int index = kpUser.Email.IndexOf("@");
         kpUser.Alias = kpUser.Email.Substring(0, index);
     }
 }
Exemple #3
0
        public static KPUser CreateVersionUser(string user)
        {
            KPUser kpUser = new KPUser();

            string[] delim      = { ",#" };
            string[] userFields = user.Split(delim, StringSplitOptions.None);
            kpUser.LoginName = userFields[1];
            kpUser.Email     = userFields[2];
            kpUser.FullName  = userFields[4];

            // Get Alias from LoginName
            GetAliasFromLoginName(kpUser);
            // Ensure email exists
            EnsureEmail(kpUser);
            // Remove extra Commas in Full Name Ex/ Ngo,, Billy
            GetFullName(kpUser);

            return(kpUser);
        }
Exemple #4
0
 /// <summary>
 // Remove extra Commas in Full Name Ex/ Ngo,, Billy
 /// </summary>
 /// <param name="fullName"></param>
 /// <returns></returns>
 private static void GetFullName(KPUser kpUser)
 {
     // Remove extra Commas in Full Name Ex/ Ngo,, Billy
     kpUser.FullName = kpUser.FullName.Replace(",,", ",");
 }