コード例 #1
0
 public SensitiveInformation FromDtoToEntityDomain()
 {
     return(new SensitiveInformation
     {
         id = Id,
         uuid = Uuid,
         type = ConvertStringToEnum <EnumSIType> .Convert(Type),
         informationName = InformationName,
         containerName = ContainerName,
         notes = Notes,
         username = Username,
         password = Password,
         cardName = CardName,
         cardEntity = CardEntity,
         cardNumber = CardNumber,
         cardExpirationDate = CardExpirationDate,
         cardSecurityNumber = CardSecurityNumber,
         contactName = ContactName,
         contactLastname = ContactLastname,
         businessName = BusinessName,
         postalCode = PostalCode,
         country = Country,
         state = State,
         birthday = Birthday,
         favorite = Favorite,
         contentKey = ContentKey,
         urlsList = UrlsList,
         tagsList = TagsList,
         emailsList = EmailsList,
         phoneNumbersList = PhoneNumbersList,
         addressesList = AddressesList,
     });
 }
コード例 #2
0
        public static SensitiveInformation GetModel(EntitySensitiveInformation entitySI)
        {
            SensitiveInformation modelSI = new SensitiveInformation();

            modelSI.id   = entitySI.id;
            modelSI.uuid = entitySI.uuid.ToString();
            modelSI.type = ConvertStringToEnum <EnumSIType> .Convert(entitySI.type);

            modelSI.informationName    = entitySI.informationName;
            modelSI.containerName      = entitySI.containerName;
            modelSI.notes              = entitySI.notes;
            modelSI.username           = entitySI.username;
            modelSI.password           = entitySI.password;
            modelSI.cardName           = entitySI.cardName;
            modelSI.cardEntity         = entitySI.cardEntity;
            modelSI.cardNumber         = entitySI.cardNumber;
            modelSI.cardExpirationDate = entitySI.cardExpirationDate;
            modelSI.cardSecurityNumber = entitySI.cardSecurityNumber;
            modelSI.contactName        = entitySI.contactName;
            modelSI.contactLastname    = entitySI.contactLastname;
            modelSI.businessName       = entitySI.businessName;
            modelSI.postalCode         = entitySI.postalCode;
            modelSI.country            = entitySI.country;
            modelSI.state              = entitySI.state;
            modelSI.birthday           = entitySI.birthday;
            modelSI.favorite           = entitySI.favorite;
            modelSI.contentKey         = entitySI.contentKey;
            modelSI.tagsList           = ConvertStringToList <string> .Convert(entitySI.tagsList);

            modelSI.addressesList = ConvertStringToList <string> .Convert(entitySI.addressesList);

            modelSI.phoneNumbersList = ConvertStringToList <string> .Convert(entitySI.phoneNumbersList);

            modelSI.emailsList = ConvertStringToList <string> .Convert(entitySI.emailsList);

            modelSI.urlsList = ConvertStringToList <string> .Convert(entitySI.urlsList);

            return(modelSI);
        }
コード例 #3
0
        internal static ModelSensitiveInformation Build(
            string optionCommand,
            ModelSensitiveInformation modelSI,
            string value)
        {
            switch (optionCommand)
            {
            case CommandOption.SI_TYPE:
                ValidatorEnumSIType.Valid(value);
                modelSI.type = ConvertStringToEnum <EnumSIType> .Convert(value);

                break;

            case CommandOption.SI_NAME:
                modelSI.informationName = value;
                break;

            case CommandOption.SI_CONTAINER:
                modelSI.containerName = value;
                break;

            case CommandOption.SI_NOTES:
                modelSI.notes = value;
                break;

            case CommandOption.SI_USERNAME:
                modelSI.username = value;
                break;

            case CommandOption.SI_PASSWORD:
                modelSI.password = value;
                break;

            case CommandOption.SI_CARD_NAME:
                modelSI.cardName = value;
                break;

            case CommandOption.SI_CARD_ENTITY:
                modelSI.cardEntity = value;
                break;

            case CommandOption.SI_CARD_NUMBER:
                modelSI.cardNumber = value;
                break;

            case CommandOption.SI_CARD_EXP_DATE:
                modelSI.cardExpirationDate = DateTime.Parse(value);
                break;

            case CommandOption.SI_CARD_SECURITY_NUMBER:
                modelSI.cardSecurityNumber = Int32.Parse(value);
                break;

            case CommandOption.SI_CONTACT_NAME:
                modelSI.contactName = value;
                break;

            case CommandOption.SI_CONTACT_LAST_NAME:
                modelSI.contactLastname = value;
                break;

            case CommandOption.SI_BUSSINES_NAME:
                modelSI.businessName = value;
                break;

            case CommandOption.SI_POSTAL_CODE:
                modelSI.postalCode = Int32.Parse(value);
                break;

            case CommandOption.SI_COUNTRY:
                modelSI.country = value;
                break;

            case CommandOption.SI_STATE:
                modelSI.state = value;
                break;

            case CommandOption.SI_BIRTHDAY:
                modelSI.birthday = DateTime.Parse(value);
                break;

            case CommandOption.SI_FAVORITE:
                modelSI.favorite = true;
                break;

            case CommandOption.SI_CONTENT_KEY:
                modelSI.contentKey = value;
                break;

            case CommandOption.SI_URLS_LIST:
                modelSI.urlsList.AddRange(value.Split(sign));
                break;

            case CommandOption.SI_TAGS_LIST:
                modelSI.tagsList.AddRange(value.Split(sign));
                break;

            case CommandOption.SI_EMAILS_LIST:
                modelSI.emailsList.AddRange(value.Split(sign));
                break;

            case CommandOption.SI_PHONE_NUMBERS_LIST:
                modelSI.phoneNumbersList.AddRange(value.Split(sign));
                break;

            case CommandOption.SI_ADDRESSES_LIST:
                modelSI.addressesList.AddRange(value.Split(sign));
                break;
            }

            return(modelSI);
        }
コード例 #4
0
        public static SensitiveInformation AddType(SensitiveInformation modelSI, string value)
        {
            modelSI.type = ConvertStringToEnum <EnumSIType> .Convert(value);

            return(modelSI);
        }
コード例 #5
0
        public string Update(int id, [FromBody] SensitiveInformationDto siDto)
        {
            List <SensitiveInformation> listSI  = ContainerUseCase.getUseCaseCrud().Read();
            SensitiveInformation        modelSI = listSI.Find(si => si.id == id);

            if (modelSI == null)
            {
                return("Not found");
            }

            if (siDto.Type != null)
            {
                modelSI.type = ConvertStringToEnum <EnumSIType> .Convert(siDto.Type);
            }
            if (siDto.InformationName != null)
            {
                modelSI.informationName = siDto.InformationName;
            }
            if (siDto.ContainerName != null)
            {
                modelSI.containerName = siDto.ContainerName;
            }
            if (siDto.Notes != null)
            {
                modelSI.notes = siDto.Notes;
            }
            if (siDto.Username != null)
            {
                modelSI.username = siDto.Username;
            }
            if (siDto.Password != null)
            {
                modelSI.password = siDto.Password;
            }
            if (siDto.CardName != null)
            {
                modelSI.cardName = siDto.CardName;
            }
            if (siDto.CardEntity != null)
            {
                modelSI.cardEntity = siDto.CardEntity;
            }
            if (siDto.CardNumber != null)
            {
                modelSI.cardNumber = siDto.CardNumber;
            }
            if (siDto.CardExpirationDate != default(DateTime))
            {
                modelSI.cardExpirationDate = siDto.CardExpirationDate;
            }
            if (siDto.CardSecurityNumber != 0)
            {
                modelSI.cardSecurityNumber = siDto.CardSecurityNumber;
            }
            if (siDto.ContactName != null)
            {
                modelSI.contactName = siDto.ContactName;
            }
            if (siDto.ContactLastname != null)
            {
                modelSI.contactLastname = siDto.ContactLastname;
            }
            if (siDto.BusinessName != null)
            {
                modelSI.businessName = siDto.BusinessName;
            }
            if (siDto.PostalCode != 0)
            {
                modelSI.postalCode = siDto.PostalCode;
            }
            if (siDto.Country != null)
            {
                modelSI.country = siDto.Country;
            }
            if (siDto.State != null)
            {
                modelSI.state = siDto.State;
            }
            if (siDto.Birthday != default(DateTime))
            {
                modelSI.birthday = siDto.Birthday;
            }
            if (siDto.Favorite)
            {
                modelSI.favorite = siDto.Favorite;
            }
            if (siDto.ContentKey != null)
            {
                modelSI.contentKey = siDto.ContentKey;
            }
            if (siDto.UrlsList != null && siDto.UrlsList.Any())
            {
                modelSI.urlsList = siDto.UrlsList;
            }
            if (siDto.TagsList != null && siDto.TagsList.Count > 0)
            {
                modelSI.tagsList = siDto.TagsList;
            }
            if (siDto.EmailsList != null && siDto.EmailsList.Any())
            {
                modelSI.emailsList = siDto.EmailsList;
            }
            if (siDto.PhoneNumbersList != null && siDto.PhoneNumbersList.Any())
            {
                modelSI.phoneNumbersList = siDto.PhoneNumbersList;
            }
            if (siDto.AddressesList != null && siDto.AddressesList.Any())
            {
                modelSI.addressesList = siDto.AddressesList;
            }
            ContainerUseCase.getUseCaseCrud().Update(id, modelSI);
            return("Updated");
        }