Beispiel #1
0
        public RecruitCardGroup ImportRecruitCardGroup(RecruitShortUIModel recruitShortUIModel)
        {
            if (recruitShortUIModel == null)
            {
                throw new ArgumentNullException(nameof(recruitShortUIModel));
            }

            var importFileReader = new ImportFileReader(recruitShortUIModel.FilePath);
            var words            = importFileReader.ReadAllWords();

            RecruitIndex idxFromRecruitShortUIModel = new RecruitIndex(recruitShortUIModel.Surname,
                                                                       recruitShortUIModel.Name,
                                                                       recruitShortUIModel.Patronymic,
                                                                       recruitShortUIModel.RegionalCollectionPoint);

            RecruitIndex firstIdxFromImportedFile  = GetFirstRecruitIdxFromImportedFile(words);
            RecruitIndex secondIdxFromImportedFile = GetSecondRecruitIdxFromImportedFile(words);

            bool isFirstRecruit  = idxFromRecruitShortUIModel == firstIdxFromImportedFile;
            bool isSecondRecruit = idxFromRecruitShortUIModel == secondIdxFromImportedFile;

            if (isFirstRecruit && isSecondRecruit)
            {
                var index = idxFromRecruitShortUIModel.ToString();
                var msg   = $"File with path: {recruitShortUIModel.FilePath} have not recruit: {index}";
                throw new ArgumentException(msg);
            }

            return(CreateCardGroup(words, isFirstRecruit));
        }
        public RemoveRecruitCommandParameters(RecruitShortUIModel recruitShortUIModel,
                                              IStateChanged stateChanged) : base(stateChanged)
        {
            if (recruitShortUIModel == null)
            {
                throw new ArgumentNullException(nameof(recruitShortUIModel));
            }

            RecruitShortUIModel = recruitShortUIModel;
        }
 public RecruitOperationEventArgs(RecruitOperation recruitOperation, RecruitShortUIModel recruitShortUIModel = null)
 {
     RecruitOperation    = recruitOperation;
     RecruitShortUIModel = recruitShortUIModel;
 }