Esempio n. 1
0
        ///<summary>Creates a username that is not yet in use. Should typically call UserWebs.GetNewPatientPortalCredentials() instead.
        ///If you are not inserting the name into UserWeb immediately then listExcludedNames should persist across multiple calls.</summary>
        public static string CreateUserNameFromPat(Patient pat, UserWebFKeyType fkeyType, List <string> listExcludedNames)
        {
            //No need to check RemotingRole; no call to db.
            string retVal       = "";
            bool   isUserNameOk = false;
            int    i            = 0;

            while (!isUserNameOk)
            {
                retVal = pat.FName + ODRandom.Next(100, 100000);
                if (!UserWebs.UserNameExists(retVal, fkeyType))
                {
                    if (!listExcludedNames.Contains(retVal))
                    {
                        isUserNameOk = true;
                    }
                }
                if (i > 1000)
                {
                    throw new CodeBase.ODException(Lans.g("UserWebs", "Unable to create username for patient."));
                }
                i++;
            }
            return(retVal);
        }
Esempio n. 2
0
        ///<summary>Creates a username that is not yet in use.</summary>
        public static string CreateUserNameFromPat(Patient pat, UserWebFKeyType fkeyType)
        {
            //No need to check RemotingRole; no call to db.
            string retVal        = "";
            bool   userNameFound = false;
            Random rand          = new Random();
            int    i             = 0;

            while (!userNameFound)
            {
                retVal = pat.FName + rand.Next(100, 100000);
                if (!UserWebs.UserNameExists(retVal, fkeyType))
                {
                    userNameFound = true;
                }
                if (i > 1000)
                {
                    throw new CodeBase.ODException(Lans.g("UserWebs", "Unable to create username for patient."));
                }
                i++;
            }
            return(retVal);
        }