//***********************************************************
// Tegratecs OO Pattern Website Base™ *
// Supplemental Example *
// Version 10.1 *
//***********************************************************
// This source code contains confidential and proprietary *
// information of Tegratecs Development Corp.® *
// *
// Original Date Written: 01/31/2021 *
// v10.1 Creation Date: 01/31/2021 *
// *
// Copyright 2022 by Tegratecs Development Corp. *
// Copyright 2023 by Tegratecs Development Corp. *
// All Rights Reserved. *
// Tegratecs Development Corp.® *
// 1320 Tower Road, Suite 118 *
// Schaumburg, IL 60173 *
// 800-739-3777 *
// *
//***********************************************************
// Module or Component: *
// UserTutorialsSubscriptionOffer1Secured.cs *
// Tegratecs OO Pattern Website Base-Supplemental Example *
// 2023-01-18 *
// Refactor to Base, PayPal Purchase routines *
//***********************************************************
using System;
using System.Configuration;
using System.Web.UI;
namespace nsFinPortWSv10
{
public partial class UserTutorialsSubscriptionOffer1Secured : WebUIPageExtendedForTegratecsWebBase
{
// begin standard global variables for the web page class
private String strThisPageURL;
private System.Collections.ArrayList arrlstPagesVisited;
private System.Collections.ArrayList arrlstPagesVisitedLastControl;
// master page
SiteLevelMasterPageCSv4 MyMasterPage;
// When using 1 master page, the page life-cycle events are intertwined between the content page and the master page
// Here is the sequence of events...
// =========================
// master Page_Init
// -------------------------
// content Page_Init
// content Page_Pre_Render
// content Page_Load
// -------------------------
// master Page_Load
// master Page_Pre-Render
// master Page_Unload
// -------------------------
// content Page_Unload
// =========================
//*********************************************************************************************************************
// Use Page_Init routine to force proper usage of SSL on secured and private pages (done in base.srPage_Init2_FPStd)
//*********************************************************************************************************************
protected void Page_Init(Object sender, EventArgs e)
{
// populate all of these global variables inside of the master page at this time (master already ran it's Page_Init)
MyMasterPage = this.Master as SiteLevelMasterPageCSv4;
// continue with the string builder object already in progress from master page
base.strbldrEvtLogBase = MyMasterPage.strbldrMasterPageEvtLog;
// best source for intSiteIndex is from master page code behind
base.intSiteIndex = MyMasterPage.intSiteIndexMP;
this.strThisPageURL = MyMasterPage.strThisPageURL;
// a check will be done for URL consistency here as a part of the standard
base.srPage_Init2_FPStd(ref strThisPageURL, ref arrlstPagesVisited, ref arrlstPagesVisitedLastControl);
MyMasterPage.arrlstPagesVisited = arrlstPagesVisited;
MyMasterPage.arrlstPagesVisitedLastControl = arrlstPagesVisitedLastControl;
MyMasterPage.boolSignInStatus = base.clsCustCtcActs.boolpropSignInStatus;
MyMasterPage.strContactGreetingMsg = base.clsCustCtcActs.strpropContactGreetingMsg;
MyMasterPage.strMemberStatus = base.clsCustCtcActs.strpropMemberStatus;
MyMasterPage.strInternetContactUserID = base.clsCustCtcActs.strpropInternetContactUserID;
MyMasterPage.strPasswordType = base.clsCustCtcActs.strpropPasswordType;
MyMasterPage.intContactUniqueID = base.clsCustCtcActs.intpropContactUniqueID;
MyMasterPage.boolFPUserCodeExists = base.clsCustCtcActs.boolpropFPUserCodeExists;
// add event handler for msg box button (on master page's pop-up message box, which
// could be used within srStdDigitalResourceAccessWrapper)
MyMasterPage.cmdevnhdlMsgBoxOKClicked += this.btnMsgBoxOKFromMasterPage;
}
//******************************************************
// Page Load Routine (based ASP.NET page cycle event)
//******************************************************
protected void Page_Load(Object sender, EventArgs e)
{
base.srPage_Load_Part_1_FPStd(strThisPageURL, ref arrlstPagesVisited, ref arrlstPagesVisitedLastControl);
if (Page.IsPostBack == false)
{
//
// Called the first time that the page is loaded or if a Redirect is used regardless of previously displayed page
// set default PayPal button area index (a string type, sorry, used to form UI control names)
ViewState["ssv_strPayPalButtonAreaIdx"] = "1";
ViewState["ssv_strErrorMessageTable"] = "tblErrorList" + ViewState["ssv_strPayPalButtonAreaIdx"].ToString();
// essentially just .focus() on control causing submit if there was one
base.srPage_Load_Part_2_FPStd(strThisPageURL, ref arrlstPagesVisited, ref arrlstPagesVisitedLastControl);
base.mCheckIBMiSQLCnnSvc_WebUIPageExtended( "hihAllowDb2iTrxStatus",
"hihAllowPayPalButtonsDependentUponIBMiSerialNumber");
}
else
{
// Page.IsPostBack occurs essentially when a page is redisplayed (unless a Redirect is issued in the code)
// Occurs even after timeout on button click event
// Occurs even after browser's back button was used to get to the page where a button was clicked
// (however, careful - viewstate returned is old in this case - server did not see this page last)
// attach values from script upon payment to session variables
if ((hihOrderID.Value != String.Empty && hihOrderID.Value != "undefined") &&
(hihPurchaseConfID.Value != String.Empty && hihPurchaseConfID.Value != "undefined"))
{
if (hihLine1Qty.Value != String.Empty)
Session["ssvstrLine1Qty"] = hihLine1Qty.Value;
else
Session["ssvstrLine1Qty"] = 0;
Session["ssvstrLine1SKU"] = hihLine1SKU.Value;
Session["ssvstrLine1OvrDesc"] = hihLine1OvrDesc.Value;
Session["ssvstrLine1Price"] = hihLine1Price.Value;
Session["ssvstrLine1UOM"] = hihLine1UOM.Value;
Session["ssvstrLine1CurrCode"] = hihLine1CurrCode.Value;
if (hihLine2Qty.Value != String.Empty)
Session["ssvstrLine2Qty"] = hihLine2Qty.Value;
else
Session["ssvstrLine2Qty"] = 0;
Session["ssvstrLine2SKU"] = hihLine2SKU.Value;
Session["ssvstrLine2OvrDesc"] = hihLine2OvrDesc.Value;
Session["ssvstrLine2Price"] = hihLine2Price.Value;
Session["ssvstrLine2UOM"] = hihLine2UOM.Value;
Session["ssvstrLine2CurrCode"] = hihLine2CurrCode.Value;
if (hihLine3Qty.Value != String.Empty)
Session["ssvstrLine3Qty"] = hihLine3Qty.Value;
else
Session["ssvstrLine3Qty"] = 0;
Session["ssvstrLine3SKU"] = hihLine3SKU.Value;
Session["ssvstrLine3OvrDesc"] = hihLine3OvrDesc.Value;
Session["ssvstrLine3Price"] = hihLine3Price.Value;
Session["ssvstrLine3UOM"] = hihLine3UOM.Value;
Session["ssvstrLine3CurrCode"] = hihLine3CurrCode.Value;
if (hihLine4Qty.Value != String.Empty)
Session["ssvstrLine4Qty"] = hihLine4Qty.Value;
else
Session["ssvstrLine4Qty"] = 0;
Session["ssvstrLine4SKU"] = hihLine4SKU.Value;
Session["ssvstrLine4OvrDesc"] = hihLine4OvrDesc.Value;
Session["ssvstrLine4Price"] = hihLine4Price.Value;
Session["ssvstrLine4UOM"] = hihLine4UOM.Value;
Session["ssvstrLine4CurrCode"] = hihLine4CurrCode.Value;
if (hihLine5Qty.Value != String.Empty)
Session["ssvstrLine5Qty"] = hihLine5Qty.Value;
else
Session["ssvstrLine5Qty"] = 0;
Session["ssvstrLine5SKU"] = hihLine5SKU.Value;
Session["ssvstrLine5OvrDesc"] = hihLine5OvrDesc.Value;
Session["ssvstrLine5Price"] = hihLine5Price.Value;
Session["ssvstrLine5UOM"] = hihLine5UOM.Value;
Session["ssvstrLine5CurrCode"] = hihLine5CurrCode.Value;
Session["ssvstrTotalQuantity"] = hihTotalQuantity.Value;
Session["ssvstrOrderID"] = hihOrderID.Value;
Session["ssvstrOrderCreateDateTimeStamp"] = hihOrderCreateDateTimeStamp.Value;
Session["ssvstrTrxStatus"] = hihTrxStatus.Value;
Session["ssvintPurchaseUnitsCount"] = hihPurchaseUnitsCount.Value;
Session["ssvintPurchaseUnitItemsCount"] = hihPurchaseUnitItemsCount.Value;
Session["ssvstrPayerGivenName"] = hihPayerGivenName.Value;
Session["ssvstrPayerSurName"] = hihPayerSurName.Value;
String strPayerNameSuffixWork = hihPayerNameSuffix.Value;
if (strPayerNameSuffixWork != "undefined" && strPayerNameSuffixWork != String.Empty)
Session["ssvstrPayerNameSuffix"] = ", " + hihPayerNameSuffix.Value;
else
Session["ssvstrPayerNameSuffix"] = String.Empty;
Session["ssvstrPayerID"] = hihPayerID.Value;
Session["ssvstrPayerPostalCode"] = hihPayerPostalCode.Value;
Session["ssvstrPayerEmailAddress"] = hihPayerEmailAddress.Value;
// Business Name data element in this interface from PayPal apparently no longer works
String strPayerBusinessNameWork = hihPayerBusinessName.Value;
if (strPayerBusinessNameWork != "undefined")
Session["ssvstrPayerBusinessName"] = hihPayerBusinessName.Value;
else
Session["ssvstrPayerBusinessName"] = String.Empty;
// Phone Number data element in this interface from PayPal apparently no longer works
Session["ssvstrPayerPhoneNumber"] = hihPayerPhoneNumber.Value;
Session["ssvstrShipToAddressLine1"] = hihShipToAddressLine1.Value;
String strShipToAddressLine2Work = hihShipToAddressLine2.Value;
if (strShipToAddressLine2Work != "undefined")
Session["ssvstrShipToAddressLine2"] = hihShipToAddressLine2.Value;
else
Session["ssvstrShipToAddressLine2"] = String.Empty;
Session["ssvstrShipToAddressLine3"] = String.Empty;
Session["ssvstrShipToCityOrAdminArea2"] = hihShipToCityOrAdminArea2.Value;
Session["ssvstrShipToStateOrAdminArea1"] = hihShipToStateOrAdminArea1.Value;
Session["ssvstrShipToPostalCode"] = hihShipToPostalCode.Value;
Session["ssvstrShipToCountry"] = hihShipToCountry.Value;
Session["ssvstrShipToAdminArea3"] = hihShipToAdminArea3.Value;
Session["ssvstrShipToAdminArea4"] = hihShipToAdminArea4.Value;
Session["ssvstrPurchaseConfTotalAmount"] = hihPurchaseConfTotalAmount.Value;
Session["ssvstrPurchaseConfCurrCode"] = hihPurchaseConfCurrCode.Value;
Session["ssvstrPurchaseConfID"] = hihPurchaseConfID.Value;
Session["ssvstrPurchaseConfTotalQty"] = Convert.ToString(Convert.ToInt32(Session["ssvstrLine1Qty"].ToString()) +
Convert.ToInt32(Session["ssvstrLine2Qty"].ToString()) +
Convert.ToInt32(Session["ssvstrLine3Qty"].ToString()) +
Convert.ToInt32(Session["ssvstrLine4Qty"].ToString()) +
Convert.ToInt32(Session["ssvstrLine5Qty"].ToString()));
Session["ssvstrPurchaseDetailsJSON"] = hihPurchaseDetailsJSON.Value;
// in the case of multiple purchase areas, determining the proper error
// message table to use got tricky, this was the best way to soft-code
Session["ssv_strPayPalButtonContainerName"] = hihPayPalButtonContainerName.Value;
ViewState["ssv_strPayPalButtonAreaIdx"] = hihPayPalButtonContainerName.Value.Substring(hihPayPalButtonContainerName.Value.Length - 1, 1);
ViewState["ssv_strErrorMessageTable"] = "tblErrorList" + ViewState["ssv_strPayPalButtonAreaIdx"].ToString();
//*************************************************************************************************
// inz hidden input fields (populated by client side script) after capture into session variables
//*************************************************************************************************
hihLine1Qty.Value = String.Empty;
hihLine1SKU.Value = String.Empty;
hihLine1OvrDesc.Value = String.Empty;
hihLine1Price.Value = String.Empty;
hihLine1UOM.Value = String.Empty;
hihLine1CurrCode.Value = String.Empty;
hihLine2Qty.Value = String.Empty;
hihLine2SKU.Value = String.Empty;
hihLine2OvrDesc.Value = String.Empty;
hihLine2Price.Value = String.Empty;
hihLine2UOM.Value = String.Empty;
hihLine2CurrCode.Value = String.Empty;
hihLine3Qty.Value = String.Empty;
hihLine3SKU.Value = String.Empty;
hihLine3OvrDesc.Value = String.Empty;
hihLine3Price.Value = String.Empty;
hihLine3UOM.Value = String.Empty;
hihLine3CurrCode.Value = String.Empty;
hihLine4Qty.Value = String.Empty;
hihLine4SKU.Value = String.Empty;
hihLine4OvrDesc.Value = String.Empty;
hihLine4Price.Value = String.Empty;
hihLine4UOM.Value = String.Empty;
hihLine4CurrCode.Value = String.Empty;
hihLine5Qty.Value = String.Empty;
hihLine5SKU.Value = String.Empty;
hihLine5OvrDesc.Value = String.Empty;
hihLine5Price.Value = String.Empty;
hihLine5UOM.Value = String.Empty;
hihLine5CurrCode.Value = String.Empty;
hihTotalQuantity.Value = String.Empty;
hihOrderID.Value = String.Empty;
hihOrderCreateDateTimeStamp.Value = String.Empty;
hihTrxStatus.Value = String.Empty;
hihPurchaseUnitsCount.Value = String.Empty;
hihPurchaseUnitItemsCount.Value = String.Empty;
hihPayerGivenName.Value = String.Empty;
hihPayerSurName.Value = String.Empty;
hihPayerNameSuffix.Value = String.Empty;
hihPayerID.Value = String.Empty;
hihPayerPostalCode.Value = String.Empty;
hihPayerEmailAddress.Value = String.Empty;
// Business Name data element from PayPal is apparently broken
hihPayerBusinessName.Value = String.Empty;
// Phone Number data element from PayPal is apparently broken
hihPayerPhoneNumber.Value = String.Empty;
hihShipToAddressLine1.Value = String.Empty;
hihShipToAddressLine2.Value = String.Empty;
// Session["ssvstrShipToAddressLine3"] = String.Empty;
hihShipToCityOrAdminArea2.Value = String.Empty;
hihShipToStateOrAdminArea1.Value = String.Empty;
hihShipToPostalCode.Value = String.Empty;
hihShipToCountry.Value = String.Empty;
hihShipToAdminArea3.Value = String.Empty;
hihShipToAdminArea4.Value = String.Empty;
hihPurchaseConfTotalAmount.Value = String.Empty;
hihPurchaseConfCurrCode.Value = String.Empty;
hihPurchaseConfID.Value = String.Empty;
hihPurchaseConfTotalQty.Value = String.Empty;
hihPurchaseDetailsJSON.Value = String.Empty;
// Session["ssv_strUTCE_sbsdlkey"] = String.Empty; // need to populate with random number
hihOrderID.Value = String.Empty;
hihPurchaseConfID.Value = String.Empty;
hihPayPalButtonContainerName.Value = String.Empty;
base.mPurchase_WebUIPageExtended(
strThisPageURL,
Session["ssvstrPurchaseConfID"].ToString(),
Session["ssvstrOrderID"].ToString(),
Session["ssv_strPayPalButtonContainerName"].ToString(),
"", "UserTutorialsSubscriptionDownloads1Secured.aspx",
"UTCE_sbsdlkey",
"User Tutorials Subscription Environment",
"User Tutorials Subscription Environment",
"Thank you for your subscription purchase to the Financial Portrait User Tutorials Cloud Environment!<br /><br />");
}
else
{
base.mCheckIBMiSQLCnnSvc_WebUIPageExtended( "hihAllowDb2iTrxStatus",
"hihAllowPayPalButtonsDependentUponIBMiSerialNumber");
}
}
base.srPage_LoadFinish_FPStd(strThisPageURL);
// master page load will follow so that is where it is easiest to test for whether to display the custom event log
}
//**************************************************************************************************
// this routine is run each time this page is displayed (after the web server sends out the page)
// do not attempt to verify results of this routine by displaying something in the page
// (because the display of the page has already occurred by the time this routine runs)
//**************************************************************************************************
protected void Page_UnLoad(Object sender, EventArgs e)
{
base.srPage_UnLoad2_FPStd(strThisPageURL);
}
protected void btnContactUs_Click(Object sender, EventArgs e)
{
clsFdnWebCS.stcAddToSsttEvnLog2(strThisPageURL, clsFdnWebCS.stcstrfctGetCtrlID((Control)sender) + "_Click", "85", ref base.strbldrEvtLogBase);
if (Session["ssv_UVPTriggerURL"] != null)
{
Session["ssv_UVPTriggerURL2Use"] = Session["ssv_UVPTriggerURL"].ToString();
Session["ssv_UVPTriggerImage2Use"] = Session["ssv_UVPTriggerImage"].ToString();
}
Response.Redirect(ConfigurationManager.AppSettings["apkContactMePage"].ToString());
}
protected void btnCheckIn_Click(Object sender, EventArgs e)
{
clsFdnWebCS.stcAddToSsttEvnLog2(strThisPageURL, clsFdnWebCS.stcstrfctGetCtrlID(sender as Control) + "_Click", "85", ref base.strbldrEvtLogBase);
Response.Redirect(ConfigurationManager.AppSettings["apkContactRegistrationPage"]);
}
//********************************************************************************************************************
// If user clicks on Back button, then Page_Init, Page_Load and then btnBack_Click are run (followed by Page_Unload)
//********************************************************************************************************************
protected void btnBack_Click(Object sender, EventArgs e)
{
clsFdnWebCS.stcAddToSsttEvnLog2(strThisPageURL, clsFdnWebCS.stcstrfctGetCtrlID(sender as Control) + "_Click", "85", ref base.strbldrEvtLogBase);
clsStdPageNavOnlyCS.stcRedirectToPreviousPage(strThisPageURL, ref arrlstPagesVisited, ref arrlstPagesVisitedLastControl);
}
// Take over for master page message box update panel
// Find reference to the pnlMsgBox object
// Record error acknowledgment/override within session variable based on error message text
// Reset error highlighting
protected void btnMsgBoxOKFromMasterPage(Object sender, EventArgs e, String strErrMsg)
{
clsFdnWebCS.stcAddToSsttEvnLog2(strThisPageURL, clsFdnWebCS.stcstrfctGetCtrlID(sender as Control) + "_Click", "85", ref base.strbldrEvtLogBase);
System.Web.UI.Control ctrlControlObjRef = new Control();
base.srGetControlObjectReference_FPStd("pnlMsgBox",
this.Page as System.Web.UI.Control, ref ctrlControlObjRef);
System.Web.UI.WebControls.Panel pnlID = new System.Web.UI.WebControls.Panel();
pnlID = ctrlControlObjRef as System.Web.UI.WebControls.Panel;
pnlID.Enabled = false;
pnlID.Visible = false;
// re-focus on button that originally triggered the error
if (ViewState["vsv_strLastControlFocus"] != null)
{
System.Web.UI.Control webuictrlObject = new Control();
base.srGetAnyWebUIControlObjRef_FPStd(ViewState["vsv_strLastControlFocus"].ToString(), ref webuictrlObject);
webuictrlObject.Focus();
}
}
}
}