private void LoadFromNode(XmlNode rootNode) { foreach (XmlNode dataNode in rootNode.ChildNodes) { switch (dataNode.Name) { case IdKey: Id = dataNode.GetNodeContentAsInt(); break; case CustomerIdKey: _customerId = dataNode.GetNodeContentAsInt(); break; case FirstNameKey: FirstName = dataNode.GetNodeContentAsString(); break; case LastNameKey: LastName = dataNode.GetNodeContentAsString(); break; case FullNumberKey: FullNumber = dataNode.GetNodeContentAsString(); break; case ExpirationMonthKey: ExpirationMonth = dataNode.GetNodeContentAsInt(); break; case ExpirationYearKey: ExpirationYear = dataNode.GetNodeContentAsInt(); break; case CvvKey: _cvv = dataNode.GetNodeContentAsString(); break; case BillingAddressKey: BillingAddress = dataNode.GetNodeContentAsString(); break; case BillingAddress2Key: BillingAddress2 = dataNode.GetNodeContentAsString(); break; case BillingCityKey: BillingCity = dataNode.GetNodeContentAsString(); break; case BillingCountryKey: BillingCountry = dataNode.GetNodeContentAsString(); break; case BillingStateKey: BillingState = dataNode.GetNodeContentAsString(); break; case BillingZipKey: BillingZip = dataNode.GetNodeContentAsString(); break; case BankNameKey: _bankName = dataNode.GetNodeContentAsString(); break; case BankRoutingNumberKey: _bankRoutingNumber = dataNode.GetNodeContentAsString(); break; case BankAccountNumberKey: _bankAccountNumber = dataNode.GetNodeContentAsString(); break; case BankAccountTypeKey: _bankAccountType = dataNode.GetNodeContentAsEnum<BankAccountType>(); break; case BankAccountHolderTypeKey: _bankAccountHolderType = dataNode.GetNodeContentAsEnum<BankAccountHolderType>(); break; case PaymentMethodNonceKey: _paymentMethodNonce = dataNode.GetNodeContentAsString(); break; case PayPalEmailKey: _payPalEmail = dataNode.GetNodeContentAsString(); break; case PaymentTypeKey: _paymentType = dataNode.GetNodeContentAsEnum<PaymentProfileType>(); break; default: break; } } }
private void LoadFromJSON(JsonObject obj) { foreach (string key in obj.Keys) { switch (key) { case IdKey: Id = obj.GetJSONContentAsInt(key); break; case CustomerIdKey: _customerId = obj.GetJSONContentAsInt(key); break; case FirstNameKey: FirstName = obj.GetJSONContentAsString(key); break; case LastNameKey: LastName = obj.GetJSONContentAsString(key); break; case FullNumberKey: FullNumber = obj.GetJSONContentAsString(key); break; case ExpirationMonthKey: ExpirationMonth = obj.GetJSONContentAsInt(key); break; case ExpirationYearKey: ExpirationYear = obj.GetJSONContentAsInt(key); break; case CvvKey: _cvv = obj.GetJSONContentAsString(key); break; case BillingAddressKey: BillingAddress = obj.GetJSONContentAsString(key); break; case BillingAddress2Key: BillingAddress2 = obj.GetJSONContentAsString(key); break; case BillingCityKey: BillingCity = obj.GetJSONContentAsString(key); break; case BillingCountryKey: BillingCountry = obj.GetJSONContentAsString(key); break; case BillingStateKey: BillingState = obj.GetJSONContentAsString(key); break; case BillingZipKey: BillingZip = obj.GetJSONContentAsString(key); break; case BankNameKey: _bankName = obj.GetJSONContentAsString(key); break; case BankRoutingNumberKey: _bankRoutingNumber = obj.GetJSONContentAsString(key); break; case BankAccountNumberKey: _bankAccountNumber = obj.GetJSONContentAsString(key); break; case BankAccountTypeKey: _bankAccountType = obj.GetJSONContentAsEnum<BankAccountType>(key); break; case BankAccountHolderTypeKey: _bankAccountHolderType = obj.GetJSONContentAsEnum<BankAccountHolderType>(key); break; case PaymentMethodNonceKey: _paymentMethodNonce = obj.GetJSONContentAsString(key); break; case PayPalEmailKey: _payPalEmail = obj.GetJSONContentAsString(key); break; case PaymentTypeKey: _paymentType = obj.GetJSONContentAsEnum<PaymentProfileType>(key); break; default: break; } } }