Exemple #1
0
        //TODO:Когда будет готова форма регистрации добавить возвращаемое значение в качестве массива строк которые потом будут выводиться напротив текстбоксов
        public static void Register(string name, string lastname, string login, string password, string phone, string email)// В разработке
        {
            Account testaccount = new Account();

            testaccount.Name            = name;
            testaccount.LastName        = lastname;
            testaccount.IsAdministrator = false;
            testaccount.Login           = login;
            testaccount.Password        = password;
            testaccount.PhoneNumber     = phone;
            testaccount.Email           = email;



            bool[] array = AuthotizationValidator.Validator(testaccount);

            if (!array[0])
            {
                MessageBox.Show("Invalid login");
            }

            if (!array[1])
            {
                MessageBox.Show("Invalid password");
            }

            if (!array[2])
            {
                MessageBox.Show("Invalid Email");
            }

            if (!array[3])
            {
                MessageBox.Show("Invalid phone");
            }

            if (!array.Any(x => x == false))
            {
                if (Registrator.Regin(testaccount))
                {
                    MessageBox.Show("Registrtion successfully");
                }
                else
                {
                    MessageBox.Show("This login alredy exist");
                }
            }
        }
Exemple #2
0
        public static bool ChnageAccountInfo(string[] accountInfo)
        {
            Account account = new Account();

            account.IsAdministrator = Convert.ToBoolean(accountInfo[0]);
            account.Name            = accountInfo[1];
            account.LastName        = accountInfo[2];

            if (AuthotizationValidator.CheckEmail(accountInfo[3]))
            {
                account.Email = accountInfo[3];
            }
            else
            {
                MessageBox.Show("Invalid Email");
                return(false);
            }

            if (AuthotizationValidator.CheckPhoneNumber(accountInfo[4]))
            {
                account.PhoneNumber = accountInfo[4];
            }

            else
            {
                MessageBox.Show("Invalid phone number ");
                return(false);
            }

            account.Login = accountInfo[5];;

            if (AuthotizationValidator.CheckPassword(accountInfo[6]))
            {
                account.Password = accountInfo[6];
            }
            else
            {
                MessageBox.Show("Invalid password ");
                return(false);
            }

            return(new DataBaseManagerAccounts().ChangeInfo(account));
        }
Exemple #3
0
 public Owner()
 {
     AuthotizationValidator.CheckPassword("");
 }