Beispiel #1
0
        void ICardHolderRepository.UpdateCardHolder(EditCardHolderModel WebData, String CardHolderName)
        {
            String EncryptedCardHolderName = GiftEncryption.Encrypt(CardHolderName);

            InitializeConnection();
            CardHolder DBCardHolder = (from c in GiftEntity.CardHolders
                                       where c.EncryptedCardHolderName == EncryptedCardHolderName
                                       select c).FirstOrDefault();

            if (DBCardHolder != null)
            {
                DBCardHolder.EncryptedFirstName = GiftEncryption.Encrypt(WebData.FirstName);
                DBCardHolder.LastName           = WebData.LastName;
                DBCardHolder.EncryptedLastName  = GiftEncryption.Encrypt(WebData.LastName);
                DBCardHolder.EncryptedAddress1  = GiftEncryption.Encrypt(WebData.Address1);
                DBCardHolder.EncryptedAddress2  = GiftEncryption.Encrypt(WebData.Address2);
                DBCardHolder.EncryptedCity      = GiftEncryption.Encrypt(WebData.City);
                DBCardHolder.State = WebData.State;
                DBCardHolder.EncryptedPostalCode = GiftEncryption.Encrypt(WebData.PostalCode);
                DBCardHolder.Country             = WebData.Country;
                String CleanPhoneNumber = extractPhoneNumber(WebData.CellPhoneNumber);
                DBCardHolder.EncryptedPhone = GiftEncryption.Encrypt(CleanPhoneNumber);
                DBCardHolder.EncryptedEmail = GiftEncryption.Encrypt(WebData.Email);

                GiftEntity.SaveChanges();
            }
        }
Beispiel #2
0
 public void MoveToWebFormat(EditCardHolderModel WebData, CardHolder DBData)
 {
     WebData.FirstName       = GiftEncryption.Decrypt(DBData.EncryptedFirstName);
     WebData.LastName        = DBData.LastName;
     WebData.Address1        = GiftEncryption.Decrypt(DBData.EncryptedAddress1);
     WebData.Address2        = GiftEncryption.Decrypt(DBData.EncryptedAddress2);
     WebData.City            = GiftEncryption.Decrypt(DBData.EncryptedCity);
     WebData.State           = DBData.State;
     WebData.PostalCode      = GiftEncryption.Decrypt(DBData.EncryptedPostalCode);
     WebData.Country         = DBData.Country;
     WebData.CellPhoneNumber = GiftEncryption.Decrypt(DBData.EncryptedPhone);
     WebData.Email           = GiftEncryption.Decrypt(DBData.EncryptedEmail);
 }
Beispiel #3
0
        EditCardHolderModel ICardHolderRepository.GetWebCardHolder(String CardHolderName)
        {
            InitializeConnection();
            String     EncryptedCardHolderName = GiftEncryption.Encrypt(CardHolderName);
            CardHolder DBCardHolder            = (from c in GiftEntity.CardHolders
                                                  where c.EncryptedCardHolderName == EncryptedCardHolderName
                                                  select c).FirstOrDefault();
            EditCardHolderModel WebData = new EditCardHolderModel();

            if (DBCardHolder == null)
            {
                return(WebData);
            }

            MoveToWebFormat(WebData, DBCardHolder);
            return(WebData);
        }