protected void gvSponsorships_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { MySponsorshipsOptions2 options = (MySponsorshipsOptions2)this.Content.GetContent(typeof(MySponsorshipsOptions2)); if (options != null) { DataRowView row = (DataRowView)e.Row.DataItem; string moreInfoUrl = options.MoreInfoPageID + "{0}id=" + row["ID"]; moreInfoUrl = moreInfoUrl.IndexOf("?") > -1 ? String.Format(moreInfoUrl, "&") : String.Format(moreInfoUrl, "?"); moreInfoUrl = moreInfoUrl + "&sponsored=y"; ((LinkButton)e.Row.FindControl("lnkNo")).PostBackUrl = moreInfoUrl; ((LinkButton)e.Row.FindControl("lnkName")).PostBackUrl = moreInfoUrl; ((ImageButton)e.Row.FindControl("imgThumbnail")).ImageUrl = "ImageHandler.ashx?context=sponsorship&type=" + options.ThumbnailNoteType + "&id=" + row["Id"]; ((ImageButton)e.Row.FindControl("imgThumbnail")).PostBackUrl = moreInfoUrl; } } }
private bool processPayment() { MySponsorshipsOptions2 options = (MySponsorshipsOptions2)this.Content.GetContent(typeof(MySponsorshipsOptions2)); BBPSPaymentInfo payment = new BBPSPaymentInfo(); payment.DemoMode = options.DemoMode; payment.MerchantAcctID = 14; payment.Bbpid = Utility.GetBbbid(14, this.API.Transactions.MerchantAccounts); payment.SkipCardValidation = false; payment.AppealID = 1; payment.Comments = ""; List <string> giftsToProcess = new List <string>(); if (ViewState["selectedSponsorships"] != null) { giftsToProcess = ViewState["selectedSponsorships"] as List <string>; } else { giftsToProcess.Add(ViewState["GiftId"].ToString()); } decimal enteredAmount = Convert.ToDecimal(this.txtAmount.Text); decimal amount = enteredAmount / giftsToProcess.Count; decimal runningTotal = 0; amount = Math.Round(amount, 2); for (int i = 0; i < giftsToProcess.Count; i++) { if (i + 1 == giftsToProcess.Count) { if (runningTotal + amount != enteredAmount) { amount = enteredAmount - runningTotal; } } int designationId = Utility.GetBbncDesignationId(giftsToProcess[i]); payment.AddDesignationInfo(amount, "BBIS Child Sponsorship Transaction", designationId); } payment.PaymentMethod = BBNCExtensions.API.Transactions.PaymentArgs.ePaymentMethod.CreditCard; payment.CreditCardCSC = this.txtCcSecurityCode.Text; payment.CreditCardExpirationMonth = Convert.ToInt32(this.cmbCcExpMonth.SelectedValue); payment.CreditCardExpirationYear = Convert.ToInt32(this.cmbCcExpYear.SelectedValue); payment.CreditCardHolderName = this.txtCcName.Text; payment.CreditCardNumber = this.txtCcNumber.Text; payment.CreditCardType = (BBNCExtensions.Interfaces.Services.CreditCardType)Enum.Parse(typeof(BBNCExtensions.Interfaces.Services.CreditCardType), this.cmbCcType.SelectedValue); payment.DonorStreetAddress = this.txtBillingAddress.Text; payment.DonorCity = this.txtBillingCity.Text; payment.DonorStateProvince = this.cmbBillingCountry.SelectedValue == "US" ? this.cmbBillingState.SelectedValue : this.txtBillingRegion.Text; payment.DonorZIP = this.txtBillingZip.Text; BBNCExtensions.API.Transactions.Donations.RecordDonationReply reply = this.API.Transactions.RecordDonation(payment.GeneratePaymentArgs()); if (!payment.InterpretPaymentReply(reply).Success) { this.lblSummary.Text = "Payment of " + enteredAmount.ToString("c") + " accepted."; this.lblError.Visible = true; this.lblError.Text = payment.InterpretPaymentReply(reply).Message; return(false); } else { return(true); } }