Example #1
0
 //проверка данных пользователя
 private bool CheckData()
 {
     if (string.IsNullOrWhiteSpace(textBoxName.Text.Trim()))
     {
         validateInput = CommandInputValidate.CommandEmpty;
         return(false);
     }
     if (listBoxCurrent.Items.Count == 0)
     {
         validateInput = CommandInputValidate.CommandCategoryNotSelected;
         return(false);
     }
     return(isUnique(textBoxName.Text.Trim()));
 }
Example #2
0
        //проверка на уникальность
        private bool isUnique(string command)
        {
            if (mode == WindowsMode.EDIT && prevCommand == textBoxName.Text.Trim())
            {
                return(true);
            }
            bool uniqueCommand = true;

            context.Commands.ToList().ForEach(loc =>
            {
                if (loc.Name == command)
                {
                    uniqueCommand = false;
                    validateInput = CommandInputValidate.CommandNotUnique;
                }
            });

            return(uniqueCommand);
        }
 //проверка данных пользователя
 private bool CheckData()
 {
     if (string.IsNullOrWhiteSpace(textBoxName.Text.Trim()))
     {
         validateInput = CommandInputValidate.CommandEmpty;
         return false;
     }           
     if (listBoxCurrent.Items.Count==0)
     {
         validateInput = CommandInputValidate.CommandCategoryNotSelected;
         return false;
     }
     return isUnique(textBoxName.Text.Trim());
 }
        //проверка на уникальность
        private bool isUnique(string command)
        {
            if (mode == WindowsMode.EDIT && prevCommand == textBoxName.Text.Trim())
            {
                return true;
            }
            bool uniqueCommand = true;
            context.Commands.ToList().ForEach(loc =>
            {
                if (loc.Name == command)
                {
                    uniqueCommand = false;
                    validateInput = CommandInputValidate.CommandNotUnique;
                }

            });

            return uniqueCommand;
        }