Esempio n. 1
0
        private void CreateMember(object source)
        {
            Console.WriteLine("Create Member");
            if (SSN == null)
            {
                Output = "Please enter SSN";
                return;
            }
            if (SSN.Length != 12)
            {
                Output = String.Format("SSN needs to be twelve characters long, \"{0}\" is {1} characters long", SSN, SSN.Length);
                return;
            }

            if (!(Password1 == Password2))
            {
                Output = "Passwords do not match.";
                return;
            }
            if (UserName == null || UserName.Length == 0)
            {
                Output = "Please enter name";
                return;
            }
            if (Password1 == null || Password1.Length == 0)
            {
                Output = "Please enter password";
                return;
            }

            try
            {
                Dal.AddMember(SSN, UserName, Utils.CryptographyUtilities.Hash(Password1, SSN));
                Output = String.Format("Successfully added member: {0}, {1}", SSN, UserName);
            }
            catch (Exception e)
            {
                HandleException(e);
            }
        }