本文整理汇总了C#中Address.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Address.Add方法的具体用法?C# Address.Add怎么用?C# Address.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initiatePayment
public override bool initiatePayment()
{
LogRequest("initiatePayment", "start");
Errors.Clear();
var BCResponse = new BankcardTransactionResponse();
if (string.IsNullOrEmpty((string) PaymentData["TokenID"]))
{
BCResponse = GetCreditCardTokenID(PaymentData["Number"].ToString(),
((DateTime) PaymentData["ExpDate"]).ToString("MMyy"),
(int) ((PayCrediCard) PaymentData).Type);
PaymentData["TokenID"] = BCResponse.PaymentAccountDataToken;
if (string.IsNullOrEmpty((string) PaymentData["TokenID"]))
{
Errors.Add(1, "Unable to generate a valid payment account data token");
return false;
}
}
var PayingInvoiceID = (int) PaymentData["InvoiceID"];
var userHostAddress = (string) PaymentData["UserHostAddress"];
var sessionID = (string) PaymentData["SessionID"];
var Amount = (decimal) PaymentData["Amount"];
var AddressLine1 = (string) PaymentData["AddressLine1"];
var AddressLine2 = (string) PaymentData["AddressLine2"];
var PostCode = (string) PaymentData["PostalCode"];
var Town = (string) PaymentData["Town"];
var Country = (string) PaymentData["Country"];
var DB = new DataClassesDataContext();
var billingAddress = new Address();
billingAddress.add_AddressLine1 = AddressLine1;
billingAddress.add_AddressLine2 = AddressLine2;
billingAddress.add_DateModified = DateTime.Now;
billingAddress.add_IsDeleted = false;
billingAddress.add_PostalCode = PostCode;
billingAddress.add_Town = Town;
billingAddress.add_Country = Country;
billingAddress.Add(DB);
var cc = new CreditCard();
cc.cca_AddressID = billingAddress.add_ID;
cc.cca_CardNumber = BCResponse.MaskedPAN;
cc.cca_IsDeleted = false;
cc.cca_IsActive = true;
cc.cca_Ref = (string) PaymentData["TransactionID"];
cc.cca_Is3DS = false;
cc.cca_ExpirationDate = ((PayCrediCard) PaymentData).ExpirationDate;
cc.cca_DateModified = DateTime.Now;
cc.cca_NameOnCard = ((PayCrediCard) PaymentData).HolderName;
cc.cca_IssueNumber = ((PayCrediCard) PaymentData).IssueNumber;
cc.CVV = ((PayCrediCard) PaymentData).CVV;
cc.cca_CardType = (short) ((PayCrediCard) PaymentData).Type;
cc.cca_IPCTokenID = (string) PaymentData["TokenID"];
cc.Add(DB);
var payment = new Payment();
payment.pay_CreditCardID = cc.cca_ID;
payment.pay_IsPaidByService = false;
payment.pay_TypeID = (int) PaymentTypeEnum.CreditCard;
payment.pay_StatusID = (int) PaymentStatusEnum.Initiated;
payment.pay_InvoiceID = PayingInvoiceID;
payment.pay_UserID = null; //logged user
payment.pay_DateModified = DateTime.Now;
payment.pay_DatePaid = DateTime.Now;
payment.pay_IP = userHostAddress;
payment.pay_Amount = Amount;
payment.pay_UserID = null;
payment.pay_Email = PaymentData["Email"].ToString();
;
payment.pay_UsedPP = Convert.ToInt32(PaymentProcessorEnum.IPCommerce);
payment.pay_InternalRefID = (string) PaymentData["TransactionID"];
payment.pay_ExternalRefID = BCResponse.TransactionId;
payment.CreditCard = cc;
payment.Add(DB, userHostAddress, sessionID);
PaymentData["PaymentID"] = payment.pay_ID;
PaymentData["TransactionID"] = "PID_" + PaymentData["PaymentID"].ToString().PadLeft(7, '0');
return Errors.Count == 0;
}