Esempio n. 1
0
 private bool        Check_Phone()
 {
     if (Phone == string.Empty || !CheckInputData.NumberCheck(Phone) ||
         !CheckInputData.PhoneCheck(Phone))
     {
         _message = "Неправильный номер телефона!!";
     }
     return(Phone != string.Empty && CheckInputData.NumberCheck(Phone) && CheckInputData.PhoneCheck(Phone));
 }
 private bool CheckCarNumber()
 {
     if (CarNumber.Length != 6)
     {
         throw new Exception("There is symbols for number?!");
     }
     return(CheckInputData.IsAlpha(CarNumber[0]) && CheckInputData.IsNumber(CarNumber[1]) &&
            CheckInputData.IsNumber(CarNumber[2]) && CheckInputData.IsNumber(CarNumber[3]) &&
            CheckInputData.IsAlpha(CarNumber[4]) && CheckInputData.IsAlpha(CarNumber[5]));
 }
Esempio n. 3
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));
 }
Esempio n. 4
0
 private bool        Check_Login()
 {
     if (Login == string.Empty || !CheckInputData.CheckLatin(Login) ||
         !CheckInputData.LoginCheck(Login))
     {
         _message = "Неправильный логин!!";
     }
     return(Login != string.Empty && CheckInputData.CheckLatin(Login) &&
            CheckInputData.LoginCheck(Login));
 }
Esempio n. 5
0
 private bool        Check_Password(string password)
 {
     if (password == string.Empty || !CheckInputData.CheckLatin(password) ||
         !CheckInputData.PasswordCheck(password))
     {
         _message = "Неправильный пароль!!";
     }
     return(password != string.Empty && CheckInputData.PasswordCheck(password) &&
            CheckInputData.CheckLatin(password));
 }
Esempio n. 6
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"
            });
        }