internal static List<SensitiveInformation> Build(
            string optionCommand, 
            string value,
            List<SensitiveInformation> listSI)
        {
            switch (optionCommand)
            {
                case CommandOptionKey.SI_UUID:
                    return UseCaseFilterList.FilterByUuid(listSI, value);

                case CommandOptionKey.SI_ID:
                    return UseCaseFilterList.FilterById(listSI, value);

                case CommandOption.SI_TYPE:
                    return UseCaseFilterList.FilterByType(listSI, value);

                case CommandOption.SI_NAME:
                    return UseCaseFilterList.FilterByName(listSI, value);

                case CommandOption.SI_CONTAINER:
                    return UseCaseFilterList.FilterByContainerName(listSI, value);

                case CommandOption.SI_NOTES:
                    return UseCaseFilterList.FilterByNotes(listSI, value);

                case CommandOption.SI_USERNAME:
                    return UseCaseFilterList.FilterByUsername(listSI, value);

                case CommandOption.SI_PASSWORD:
                    return UseCaseFilterList.FilterByPassword(listSI, value);

                case CommandOption.SI_CARD_NAME:
                    return UseCaseFilterList.FilterByCardName(listSI, value);

                case CommandOption.SI_CARD_ENTITY:
                    return UseCaseFilterList.FilterByCardEntity(listSI, value);

                case CommandOption.SI_CARD_NUMBER:
                    return UseCaseFilterList.FilterByCardNumber(listSI, value);

                case CommandOption.SI_CARD_EXP_DATE:
                    return UseCaseFilterList.FilterByCardExpirationDate(listSI, value);

                case CommandOption.SI_CARD_SECURITY_NUMBER:
                    return UseCaseFilterList.FilterByCardSecurityNumber(listSI, value);

                case CommandOption.SI_CONTACT_NAME:
                    return UseCaseFilterList.FilterByContactName(listSI, value);

                case CommandOption.SI_CONTACT_LAST_NAME:
                    return UseCaseFilterList.FilterByContactLastname(listSI, value);

                case CommandOption.SI_BUSSINES_NAME:
                    return UseCaseFilterList.FilterByBusinessName(listSI, value);

                case CommandOption.SI_POSTAL_CODE:
                    return UseCaseFilterList.FilterByPostalCode(listSI, value);

                case CommandOption.SI_COUNTRY:
                    return UseCaseFilterList.FilterByCountry(listSI, value);

                case CommandOption.SI_STATE:
                    return UseCaseFilterList.FilterByState(listSI, value);

                case CommandOption.SI_BIRTHDAY:
                    return UseCaseFilterList.FilterByBirthday(listSI, value);

                case CommandOption.SI_FAVORITE:
                    return UseCaseFilterList.FilterByFavorite(listSI);

                case CommandOption.SI_CONTENT_KEY:
                    return UseCaseFilterList.FilterByContentKey(listSI, value);

                case CommandOption.SI_URLS_LIST:
                    return UseCaseFilterList.FilterByUrlsList(listSI, value);

                case CommandOption.SI_TAGS_LIST:
                    return UseCaseFilterList.FilterByTagsList(listSI, value);

                case CommandOption.SI_EMAILS_LIST:
                    return UseCaseFilterList.FilterByEmailsList(listSI, value);

                case CommandOption.SI_PHONE_NUMBERS_LIST:
                    return UseCaseFilterList.FilterByPhoneNumbersList(listSI, value);

                case CommandOption.SI_ADDRESSES_LIST:
                    return UseCaseFilterList.FilterByAddressesList(listSI, value);
            }
            return listSI;
        }
Ejemplo n.º 2
0
        public IEnumerable <SensitiveInformationDto> Filter([FromBody] SensitiveInformationDto filter)
        {
            List <SensitiveInformation> list = ContainerUseCase.getUseCaseCrud().Read();

            if (filter.Uuid != null)
            {
                list = UseCaseFilterList.FilterByUuid(list, filter.Uuid);
            }
            if (filter.Id != 0)
            {
                list = UseCaseFilterList.FilterById(list, filter.Id.ToString());
            }
            if (filter.Type != null)
            {
                list = UseCaseFilterList.FilterByType(list, filter.Type);
            }
            if (filter.InformationName != null)
            {
                list = UseCaseFilterList.FilterByName(list, filter.InformationName);
            }
            if (filter.ContainerName != null)
            {
                list = UseCaseFilterList.FilterByContainerName(list, filter.ContainerName);
            }
            if (filter.Notes != null)
            {
                list = UseCaseFilterList.FilterByNotes(list, filter.Notes);
            }
            if (filter.Username != null)
            {
                list = UseCaseFilterList.FilterByUsername(list, filter.Username);
            }
            if (filter.Password != null)
            {
                list = UseCaseFilterList.FilterByPassword(list, filter.Password);
            }
            if (filter.CardName != null)
            {
                list = UseCaseFilterList.FilterByCardName(list, filter.CardName);
            }
            if (filter.CardEntity != null)
            {
                list = UseCaseFilterList.FilterByCardEntity(list, filter.CardEntity);
            }
            if (filter.CardNumber != null)
            {
                list = UseCaseFilterList.FilterByCardNumber(list, filter.CardNumber);
            }
            if (filter.CardExpirationDate != default(DateTime))
            {
                list = UseCaseFilterList.FilterByCardExpirationDate(list, filter.CardExpirationDate.ToString());
            }
            if (filter.CardSecurityNumber != 0)
            {
                list = UseCaseFilterList.FilterByUuid(list, filter.CardSecurityNumber.ToString());
            }
            if (filter.ContactName != null)
            {
                list = UseCaseFilterList.FilterByContactName(list, filter.ContactName);
            }
            if (filter.ContactLastname != null)
            {
                list = UseCaseFilterList.FilterByContactLastname(list, filter.ContactLastname);
            }
            if (filter.BusinessName != null)
            {
                list = UseCaseFilterList.FilterByBusinessName(list, filter.BusinessName);
            }
            if (filter.PostalCode != 0)
            {
                list = UseCaseFilterList.FilterByPostalCode(list, filter.PostalCode.ToString());
            }
            if (filter.Country != null)
            {
                list = UseCaseFilterList.FilterByCountry(list, filter.Country);
            }
            if (filter.State != null)
            {
                list = UseCaseFilterList.FilterByState(list, filter.State);
            }
            if (filter.Birthday != default(DateTime))
            {
                list = UseCaseFilterList.FilterByBusinessName(list, filter.Birthday.ToString());
            }
            if (filter.Favorite)
            {
                list = UseCaseFilterList.FilterByFavorite(list);
            }
            if (filter.ContentKey != null)
            {
                list = UseCaseFilterList.FilterByContentKey(list, filter.ContentKey);
            }
            if (filter.UrlsList != null && filter.UrlsList.Any())
            {
                list = UseCaseFilterList.FilterByUrlsList(list, filter.UrlsList);
            }
            if (filter.TagsList != null && filter.TagsList.Count > 0)
            {
                list = UseCaseFilterList.FilterByTagsList(list, filter.TagsList);
            }
            if (filter.EmailsList != null && filter.EmailsList.Any())
            {
                list = UseCaseFilterList.FilterByEmailsList(list, filter.EmailsList);
            }
            if (filter.PhoneNumbersList != null && filter.PhoneNumbersList.Any())
            {
                list = UseCaseFilterList.FilterByPhoneNumbersList(list, filter.PhoneNumbersList);
            }
            if (filter.AddressesList != null && filter.AddressesList.Any())
            {
                list = UseCaseFilterList.FilterByAddressesList(list, filter.AddressesList);
            }

            return(list.Select(si => SensitiveInformationDto.FromEntityToDto(si)));
        }