Beispiel #1
0
 private bool        Check_Email()
 {
     if (Email == string.Empty || CheckInputData.CheckLatin(Email) == false ||
         CheckInputData.EmailCheck(Email) == false)
     {
         _message = "Неправильная почта!!";
     }
     return(Email != string.Empty && CheckInputData.CheckLatin(Email) &&
            CheckInputData.EmailCheck(Email));
 }
Beispiel #2
0
        private void                        CreateNewEmployeeMethod()
        {
            if (!CheckInputData.CheckNotEmptyString(Login) || !CheckInputData.CheckLatin(Login) ||
                CheckInputData.LoginCheck(Login))
            {
                IoC.UI.CommunicationDialog(new MessageBoxDialogViewModel {
                    Message = "Некорректный логин", Title = "Ошибка"
                });
                return;
            }
            if (!CheckInputData.CheckNotEmptyString(Password) || !CheckInputData.CheckLatin(Password) ||
                CheckInputData.PasswordCheck(Password))
            {
                IoC.UI.CommunicationDialog(new MessageBoxDialogViewModel {
                    Message = "Некорректный пароль", Title = "Ошибка"
                });
                return;
            }
            if (!CheckInputData.CheckNotEmptyString(FullName))
            {
                IoC.UI.CommunicationDialog(new MessageBoxDialogViewModel {
                    Message = "Некорректное ФИО", Title = "Ошибка"
                });
                return;
            }
            if (!CheckInputData.CheckNotEmptyString(Phone) || !CheckInputData.NumberCheck(Phone))
            {
                IoC.UI.CommunicationDialog(new MessageBoxDialogViewModel {
                    Message = "Некорректный номер телефона", Title = "Ошибка"
                });
                return;
            }
            if (!CheckInputData.CheckNotEmptyString(Email) || !CheckInputData.CheckLatin(Email) ||
                CheckInputData.EmailCheck(Email))
            {
                IoC.UI.CommunicationDialog(new MessageBoxDialogViewModel {
                    Message = "Некорректная эл.почта", Title = "Ошибка"
                });
                return;
            }
            if (!CheckInputData.CheckNotEmptyString(Position))
            {
                IoC.UI.CommunicationDialog(new MessageBoxDialogViewModel {
                    Message = "Некорректная должность", Title = "Ошибка"
                });
                return;
            }

            WorkWithDB.Set_User_Async(new Employee()
            {
                Login       = this.Login,
                Parol       = Password,
                FullName    = this.FullName,
                PhoneNumber = this.Phone,
                Email       = this.Email,
                Position    = this.Position,
                Salary      = this.Position == "Driver" ? 50000 : 70000,
                Task        = this.Position == "Driver" ? "Take and deliver orders" : "Accept and distribute orders",
            });
            Login    = "";
            Password = "";
            FullName = "";
            Phone    = "";
            Email    = "";
            Position = "";
            IoC.AdminView.Set_Employees();
            IoC.UI.CommunicationDialog(new MessageBoxDialogViewModel()
            {
                Message = "Сотрудник создан!!", Title = "Success"
            });
        }