Example #1
0
        public override bool Execute()
        {
            if (!Verifier.CheckLogin(Login))
            {
                Information = StringSource.LoginStructureError();
                return(false);
            }
            if (!Verifier.CheckPassword(Password) || !Verifier.CheckPassword(PasswordCheck))
            {
                Information = StringSource.PasswordStructureError();
                return(false);
            }
            if (Password != PasswordCheck)
            {
                Information = StringSource.PasswordNotIndentical();
                return(false);
            }

            using (var bankservice = new BankServiceClient()) {
                Operator = bankservice.GetEmployeeByLogin(Login);
            }

            if (Operator != null)
            {
                Information = StringSource.LoginIsContains();
                return(false);
            }

            using (var bankservice = new BankServiceClient()) {
                Operator = new Employee {
                    Login = Login, Password = Password, IsAdmin = false
                };
                bankservice.AddEmployee(Operator);
            }
            IdOperator  = Operator.EmployeeID;
            Information = StringSource.OperatorRegistred();

            return(true);
        }
Example #2
0
        public override bool Execute()
        {
            if (!Verifier.CheckLogin(Login))
            {
                Information = StringSource.LoginStructureError();
                return(false);
            }

            using (var bankservice = new BankServiceClient()) {
                Operator = bankservice.GetEmployeeByLogin(Login);
            }

            if (Operator != null)
            {
                Information = StringSource.OperatorInformation(Operator);
                IdOperator  = Operator.EmployeeID;
                return(true);
            }
            else
            {
                Information = StringSource.OperatorNotFound();
                return(false);
            }
        }