HERE IS THE CODE FOR THE SUBTOTALANDPAYMENTINFO.ASCX.CS
//===========================================================================
// This file was modified as part of an ASP.NET 2.0 Web project conversion.
// The class name was changed and the class modified to inherit from the abstract base class
// in file 'App_Code\Migrated\controls\payment\Stub_subtotalandpaymentinfo_ascx_cs.cs'.
// During runtime, this allows other classes in your web application to bind and access
// the code-behind page using the abstract base class.
// The associated content page 'controls\payment\subtotalandpaymentinfo.ascx' was also modified to refer to the new class name.
// For more information on this code pattern, please refer to http://go.microsoft.com/fwlink/ LinkId=46995
//===========================================================================
namespace WMProShop.Controls.Payment
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using WMProShop.Students;
using CCTranMan;
using WMProShop.BLL;
using System.Diagnostics;
/// <summary>
/// Summary description for SubtotalAndPaymentInfo.
/// </summary>
public partial class Migrated_SubtotalAndPaymentInfo : SubtotalAndPaymentInfo
{
protected void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
lblError2.Visible = false;
lblWrongInfo.Visible = false;
if(!IsPostBack)
{
PaymentInfo payment = (( CreditCardInfo)Page).PaymentControl;
// PersonInformation billingInfo = ((CreditCardInfo)Page).BillingInfo;
// PersonInformation shippingInfo = ((CreditCardInfo)Page).ShippingInfo;
string strBaseLink = "MM_openBrWindow('{0}','{1}','width={2},height=500,scrollbars=yes,resizeable=yes')";
string filename = PageLinkURLs.TERMS_AND_CONDITIONS.Substring(1);
string strTAndC = "http://" + Request.Url.Host + Request.ApplicationPath + filename;
lnkTermsAndConditions.Attributes.Add( "onclick",string.Format(strBaseLink,strTAndC,"TANDC",600));
LoadData();
}
}
// public void LoadData()
override public void LoadData()
{
BindPriceTotalControl();
}
private void BindPriceTotalControl()
{
ControlInfoHelper.StateAbbreviations state = OrderHelper.ShippingState;
m_PriceTotalControl.SubTotal = OrderHelper.Subtotal;
m_PriceTotalControl.SalesTax = OrderHelper.TCItemSalesTax;
m_PriceTotalControl.Discount = OrderHelper.DiscountForTCProducts;
m_PriceTotalControl.SubtotalAfterDiscount = OrderHelper.SubtotalAfterDiscount;
m_PriceTotalControl.ShippingAndHandling = OrderHelper.TCItemShippingAndHandling;
m_PriceTotalControl.Total = OrderHelper.TotalCost;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.imgSubmitBtn.Click += new System.Web.UI.ImageClickEventHandler(this.imgSubmitBtn_Click);
this.imgButtonContinue.Click += new System.Web.UI.ImageClickEventHandler(this.imgButtonContinue_Click);
}
#endregion
private void PayAndContinue()
{
if(Page.IsValid)
{
try
{
//
OrderHelper.SubmitPayment(BuildTransaction());
//
Server.Transfer( PageLinkURLs.ORDER_CONFIRMATION);
}
catch(InvalidTransactionException)
{
lblWrongInfo.Visible = true;
}
catch(InvalidPromotionException)
{
lblPromoExpired.Visible = true;
}
catch(Exception e2)
{
imgSubmitBtn.Visible = false;
imgButtonContinue.Visible = true;
lblError2.Visible = true;
OrderHelper.CompleteOrder();
Trace.Warn( "bad tx",e2.ToString(),e2);
Debug.WriteLine(e2.ToString());
}
//Server.Transfer(PageLinkURLs.ORDER_CONFIRMATION);
}
}
private void btnPay_Click(object sender, System.EventArgs e)
{
lblPromoExpired.Visible = false;
lblError2.Visible = false;
PayAndContinue();
}
private CCTranMan.CreditCardTransaction BuildTransaction()
{
CCTranMan. CreditCardTransaction tran = new CreditCardTransaction();
PersonInfoStruct m_BillingInfo = OrderHelper.BillingInfo;
PersonInfoStruct m_ShippingInfo = OrderHelper.ShippingInfo;
// Configure the transaction that will be submitted to the gateway
tran.CustomerFirstName = m_BillingInfo.FirstName;
tran.CustomerLastName = m_BillingInfo.LastName;
tran.CustomerAddress = m_BillingInfo.Address;
tran.CustomerCity = m_BillingInfo.City;
tran.CustomerState = m_BillingInfo.State;
tran.CustomerZipCode = m_BillingInfo.Zip;
tran.CustomerCountry = "US";
tran.CustomerPhone = m_BillingInfo.PhoneNumber;
tran.CustomerEmail = m_BillingInfo.EmailAddress;
// Configure the transaction to contain the shipping info
tran.ShipToFirstName = m_ShippingInfo.FirstName;
tran.ShipToLastName = m_ShippingInfo.LastName;
tran.ShipToAddress = m_ShippingInfo.Address;
tran.ShipToCity = m_ShippingInfo.City;
tran.ShipToState = m_ShippingInfo.State;
tran.ShipToZipCode = m_ShippingInfo.Zip;
tran.ShipToCountry = "US";
// Set up as a test transaction for now
if(ProShopAdminInfoHelper.TestMode == true)
{
tran.TransactionTestRequest = CCTranMan. TristateValue.TristateTrue;
}
else
{
tran.TransactionTestRequest = CCTranMan. TristateValue.TristateFalse;
}
// Set up as authorization
tran.TransactionMode = CCTranMan. TransactionType.AuthorizeCapture;
tran.TransactionAmount = OrderHelper.TotalCost;
tran.CreditCardNumber = m_CreditCardInformation.CreditCardNumber;
tran.CreditCardExpirationDate = m_CreditCardInformation.Expiration;
tran.CreditCardCode = m_CreditCardInformation.SecurityCode;
return tran;
}
private void imgSubmitBtn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
PayAndContinue();
}
private void imgButtonContinue_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
string shoppingURL = PageLinkURLs.SHOPPING_CATALOG.Substring(1);
Response.Redirect( "http://" + Request.Url.Host + Request.ApplicationPath + shoppingURL);
}
}
}
|