示例#1
0
        public IEnumerable <RecordMateria> GetRecordMateriasBySearch(RecordMateria searchPrototype)
        {
            _logger.LogInformation($"Logic Method invoked: {nameof(GetRecordMateriasBySearch)}");


            //ignore: Id, Description, LegendMateriaId, JapaneseName, CharacterName, ImagePath, RelicName, IsChecked
            var query = _enlirRepository.GetMergeResultsContainer().RecordMaterias;

            if (searchPrototype.Realm != 0)
            {
                query = query.Where(l => l.Realm == searchPrototype.Realm);
            }
            if (!string.IsNullOrWhiteSpace(searchPrototype.RecordMateriaName))
            {
                query = query.Where(l => l.RecordMateriaName.ToLower().Contains(searchPrototype.RecordMateriaName.ToLower()));
            }
            if (searchPrototype.CharacterId != 0)
            {
                query = query.Where(l => l.CharacterId == searchPrototype.CharacterId);
            }
            if (!string.IsNullOrWhiteSpace(searchPrototype.Effect))
            {
                query = query.Where(l => l.Effect.ToLower().Contains(searchPrototype.Effect.ToLower()));
            }
            if (!string.IsNullOrWhiteSpace(searchPrototype.UnlockCriteria))
            {
                query = query.Where(l => l.UnlockCriteria.ToLower().Contains(searchPrototype.UnlockCriteria.ToLower()));
            }

            return(query);
        }
示例#2
0
        public IActionResult GetRecordMateriasBySearch([FromBody] D.RecordMateria searchPrototype)
        {
            _logger.LogInformation($"Controller Method invoked: {nameof(GetRecordMateriasBySearch)}");

            RecordMateria recordMateria = _mapper.Map <RecordMateria>(searchPrototype);

            IEnumerable <RecordMateria> model = _recordMateriasLogic.GetRecordMateriasBySearch(recordMateria);

            IEnumerable <D.RecordMateria> result = _mapper.Map <IEnumerable <D.RecordMateria> >(model);

            return(new ObjectResult(result));
        }
        public List <RecordMateria> BuildRecordMateriaInfoByName(string name)
        {
            var recordMaterias    = materiaRepository.GetRecordMateriasByCharName(name);
            var newRecordMaterias = new List <RecordMateria>();

            foreach (var materia in recordMaterias)
            {
                var newMateria = new RecordMateria();

                newMateria.Info     = materia;
                newMateria.Statuses = statusRepository.GetStatusesByEffectText(materia.Name, materia.Effect);
                newMateria.Others   = new Dictionary <string, List <SheetOthers> >();

                statusRepository.GetOthersByNamesAndSource(materia.Name, newMateria.Others);

                newRecordMaterias.Add(newMateria);
            }

            return(newRecordMaterias);
        }
示例#4
0
        private void WireUpOtherSourceInfo(TransformResultsContainer transformResults)
        {
            foreach (Other other in transformResults.Others)
            {
                //first check statuses for match
                Status relatedStatus = transformResults.Statuses.SingleOrDefault(s => s.CommonName.Trim() == other.SourceName.Trim());
                if (relatedStatus != null) //this is the match
                {
                    other.SourceId   = relatedStatus.Id;
                    other.SourceType = nameof(Status);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                //next check soul breaks for match
                SoulBreak relatedSoulBreak = transformResults.SoulBreaks.SingleOrDefault(s => s.SoulBreakName.Trim() == other.SourceName.Trim() &&
                                                                                         (s.CharacterName.Trim() == other.CharacterName.Trim()));
                if (relatedSoulBreak != null) //this is the match
                {
                    other.SourceId   = relatedSoulBreak.Id;
                    other.SourceType = nameof(SoulBreak);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                RecordMateria relatedRecordMateria = transformResults.RecordMaterias.SingleOrDefault(r => r.RecordMateriaName.Trim() == other.SourceName.Trim());
                if (relatedRecordMateria != null) //this is the match
                {
                    other.SourceId   = relatedRecordMateria.Id;
                    other.SourceType = nameof(RecordMateria);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                Relic relatedRelic = transformResults.Relics.SingleOrDefault(r => r.RelicName.Trim() == other.SourceName.Trim());
                if (relatedRelic != null) //this is the match
                {
                    other.SourceId   = relatedRelic.Id;
                    other.SourceType = nameof(Relic);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                Command relatedCommand = transformResults.Commands.SingleOrDefault(c => c.CommandName.Trim() == other.SourceName.Trim());
                if (relatedCommand != null) //this is the match
                {
                    other.SourceId   = relatedCommand.Id;
                    other.SourceType = nameof(Command);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                IList <LegendMateria> relatedLegendMateria = transformResults.LegendMaterias.Where(l => l.LegendMateriaName == other.SourceName).ToList();
                if (relatedLegendMateria != null && relatedLegendMateria.Count == 1) //this is the match
                {
                    other.SourceId   = relatedLegendMateria.First().Id;
                    other.SourceType = nameof(LegendMateria);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                _logger.LogWarning("FAILED to wire up SourceId and SourceType to Other {Other}", other.Description);
            }
        }