C# Code Examples



Listed below are a variety of C# examples written for production environments. All of these examples are automated and used to provide daily reporting for a variety of clients. Many more examples are available on my Github account. The example directly below pulls accounts payable information from an API using token authentication


//namespace SCC_VendorMaster_TBL
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics; 

using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

//----------------------------------
//     SCC_VendorMaster_TBL
//----------------------------------

// Note: Purchasing => GP API Connector) Vendor Data


namespace SCC_VendorMaster_TBL
{
public class Program
{
public string company_Name { get; set; }
public string mailing_City { get; set; }
public string form_1099_Box { get; set; }
public string mailing_Postal_Code { get; set; }
public string mailing_Address3 { get; set; }
public string billing_Terms { get; set; }
public string mailing_State { get; set; }
public string mailing_Address2 { get; set; }
public string contactName { get; set; }
public string mailing_Address1 { get; set; }
public string vendor_ID { get; set; }
public Dictionary
[] report { get; set; }


class RootObj
{
public string logid { get; set; }
public Data data { get; set; }
}

class Data
{
public Dictionary
[] report { get; set; }
}

public async Task callWebApi()
{
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "http://something.com/api/beta1/reports?reportKey=Sadgasdfasdjkjalsdjfasd8334NEZlUT090"))

{
request.Headers.TryAddWithoutValidation("APIAccessToken", "YmyoDn7I234234gZbFTl/6AGgjA911512343TaDCsGgGI//REx3my9F45151234Hd0FCA==");
request.Headers.TryAddWithoutValidation("UserToken", "VREU6QiGjy8Ho9y6mN/dmC1234349+Y5VwMbgCX4CF+xN0v13RcDDJEyVOJJJTHMHVZJ43MdmpPCJdg==");

var response = await httpClient.SendAsync(request);

using (HttpContent content = response.Content)
{
var jsonString = await response.Content.ReadAsStringAsync();

RootObj mainObj = JsonConvert.DeserializeObject
(jsonString);

JToken jToken = JToken.Parse(jsonString);

DataTable dt = jToken["data"]["report"].ToObject
();

using (SqlConnection con = new SqlConnection("Data Source = MND-3431-SQL; Initial Catalog = MCHI; User ID = Chicago; Password = 123512343; "))
{
SqlCommand myCommand = new SqlCommand("TRUNCATE TABLE [MCHI].[dbo].[SCC_VendorMaster_TBL];", con);
con.Open();

myCommand.ExecuteNonQuery();
con.Close();

};

foreach (DataRow dr in dt.Rows)
{

using (SqlConnection con = new SqlConnection("Data Source = MMG-2454T-SQL; Initial Catalog = MCHI; User ID = Chicago; Password = c23542345; "))
{
con.Open();
myCommand.ExecuteNonQuery();
}

};

//using (SqlConnection con = new SqlConnection("Data Source = MMG-A243545T-SQL; Initial Catalog = TMCHI; User ID = Chicago; Password = c234524353; "))
//{
//    SqlCommand myCommand = new SqlCommand("EXECUTE SCC_VendorMaster_SP;", con);
//    con.Open();

//    myCommand.ExecuteNonQuery();
//    con.Close();

//};

}
}
}
}

public static void Main(string[] args)
{
Program P1 = new Program();
try
{
P1.callWebApi().Wait();
}
catch (Exception ex)
{
Console.WriteLine("There was an exception, {0}", ex.ToString());
Console.Read();
}
}
}

}
                                        

Accounts Receivable


The example directly below pulls vendor accounts receivable from an API into a database




using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;


namespace SCC_APVendorInvoiceData_TBL
{

//----------------------------------
//    SCC_APVendorInvoiceData_TBL
//----------------------------------

//Note: Comes from Vendor Invoice Data

public class Program
{
public string purchase_Order_Number { get; set; }
public string vendor_ID { get; set; }
public string invoice_Number { get; set; }
public string line_Net_Cost { get; set; }
public string invoice_Date { get; set; }
public string type_of_Voucher { get; set; }
public string posting_Date { get; set; }
public string unique_Auto_Number { get; set; }
public string terms_Net { get; set; }
public string invoice_Due_Date { get; set; }
public string aP_Account_Number { get; set; }
public string expense_Account_Number { get; set; }
public string expense_Account_Name { get; set; }

public string invoice_Status { get; set; }

public Dictionary
[] report { get; set; }

class RootObj
{
public string logid { get; set; }
public Data data { get; set; }
}

class Data
{
public Dictionary
[] report { get; set; }
}

public async Task callWebApi()
{
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://something.com/api/beta1/reports?reportKey=MHU5234542345lHUT090"))

{
request.Headers.TryAddWithoutValidation("APIAccessToken","YmyoDn7Iv23452345bFTl/6AGgjA91qO4JErGmeE2345GI//REx3my923454Hd0FCA==");
request.Headers.TryAddWithoutValidation("UserToken","VREU6QiGjy8Ho9y6mN/dmCnORKIep2545454CF+xN0v13RcD252444554JTHMHVZJ43MdmpPCJdg==");

var response = await httpClient.SendAsync(request);

using (HttpContent content = response.Content)
{
var jsonString = await response.Content.ReadAsStringAsync();

RootObj mainObj = JsonConvert.DeserializeObject
(jsonString);

JToken jToken = JToken.Parse(jsonString);

DataTable dt = jToken["data"]["report"].ToObject
    ();


    using (SqlConnection con = new SqlConnection("Data Source = MM4545G-A23454-S454QL; Initial Catalog = AGDFI; User ID = Chicago; Password = 23454545; "))
    {
    SqlCommand myCommand = new SqlCommand("TRUNCATE TABLE [MCHI].[dbo].[SCC_APVendorInvoiceData_TBL]; ", con);
    con.Open();

    myCommand.ExecuteNonQuery();
    con.Close();

    };



    foreach (DataRow dr in dt.Rows)
    {

    dr["type_of_Voucher"] ?? (object)DBNull.Value);


    myCommand.ExecuteNonQuery();

    }
    }
    }
    }
    }
    }

    public static void Main(string[] args)
    {
    Program P1 = new Program();
    try
    {
    P1.callWebApi().Wait();
    }
    catch (Exception ex)
    {
    Console.WriteLine("There was an exception, {0}", ex.ToString());
    Console.Read();
    }
    }
    }
    }


Accounts Payable


The example directly below pulls vendor accounts payable from an API into a database





//namespace SCC_ARCustomerInvoiceData_TBL
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace SCC_ARCustomerInvoiceData_TBL
{

//----------------------------------
//    SCC_APVendorInvoiceData_TBL
//----------------------------------

//Note: Comes from (GP API Connector) Client AR Invoice Data For GP 

public class Program
{

public string date_Posted { get; set; }
public string debit_Amount { get; set; }
public string client_ID { get; set; }
public string transaction_Date { get; set; }
public string gL_Account_Name { get; set; }
public string transaction_Reference { get; set; }
public string credit_Amount { get; set; }
public string gL_Account_Number { get; set; }


public Dictionary
[] report { get; set; }

class RootObj
{
public string logid { get; set; }
public Data data { get; set; }
}

class Data
{
public Dictionary
    [] report { get; set; }
    }

    public async Task callWebApi()
    {
    using (var httpClient = new HttpClient())
    {
    using (var request = new HttpRequestMessage(new HttpMethod("GET"), "http://something.net/api/beta1/reports?reportKey=a1lHYasdfasdfasdfasdfad90"))

    {
    request.Headers.TryAddWithoutValidation("APIAccessToken", "YmyoDn7IadfdfadsfgZbFTl/6AGgjA91qO4JErGmeEihdTaDCsGgGI//REx3my9F45lafadfdRQwHd0FCA==");
    request.Headers.TryAddWithoutValidation("UserToken", "VREU6QiGjy8Ho9y6mN/dmCnORadsfdfMbgCX4CF+xN0v13RcDDJEyVOJJJTHadfdfdg==");

    var response = await httpClient.SendAsync(request);

    using (HttpContent content = response.Content)
    {
    var jsonString = await response.Content.ReadAsStringAsync();

    RootObj mainObj = JsonConvert.DeserializeObject
        (jsonString);

        JToken jToken = JToken.Parse(jsonString);

        DataTable dt = jToken["data"]["report"].ToObject
            ();


            using (SqlConnection con = new SqlConnection("Data Source = MMG-ACCT-SQL; Initial Catalog = TM23454I; User ID = Chicago; Password = ch2345243; "))
            {
            SqlCommand myCommand = new SqlCommand("TRUNCATE TABLE [MCHI].[dbo].[SCC_ARCustomerInvoiceData_TBL]; ", con);
            con.Open();

            myCommand.ExecuteNonQuery();
            con.Close();

            };



            foreach (DataRow dr in dt.Rows)
            {

               


            {

            myCommand.ExecuteNonQuery();

            }
            }
            }
            }
            }
            }

            public static void Main(string[] args)
            {
            Program P1 = new Program();
            try
            {
            P1.callWebApi().Wait();
            }
            catch (Exception ex)
            {
            Console.WriteLine("There was an exception, {0}", ex.ToString());
            Console.Read();
            }
            }
            }
            }




Store Data API Pull


The example directly below pulls from a store information API into a database





using System;
using System.Data;
//using Microsoft.SqlServer.Dts.Runtime;
//using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Data.Sql;
using System.Data.SqlClient;
using Newtonsoft.Json;

namespace Nov17
{

public class Store
{
static WebClient client = new WebClient();
public static string reply = client.DownloadString("http://client.adfdadft.com/easdfadft_logincontrol_api.php?akey=1352adfadsfadsfasdfadf5as");
private string Login_Id;
private string Username;
private string Login_Time;
private string active;
private string Initial_Load;
private string alt_name;
private string Loaded;
private string Loaded_On;
private string Imported_By;
private string str_munique;

[JsonProperty("Login_Id")]
public string Login_Id1 { get => Login_Id; set => Login_Id = value; }
[JsonProperty("Username")]
public string Username1 { get => Username; set => Username = value; }
[JsonProperty("Login_Time")]
public string Login_Time1 { get => Login_Time; set => Login_Time = value; }
[JsonProperty("active")]
public string Active { get => active; set => active = value; }
[JsonProperty("Initial_Load")]
public string Initial_Load1 { get => Initial_Load; set => Initial_Load = value; }
[JsonProperty("alt_name")]
public string Alt_name { get => alt_name; set => alt_name = value; }
[JsonProperty("Loaded")]
public string Loaded1 { get => Loaded; set => Loaded = value; }
[JsonProperty("Imported_By")]
public string Imported_By1 { get => Imported_By; set => Imported_By = value; }
[JsonProperty("Loaded_On")]
public string Loaded_On1 { get => Loaded_On; set => Loaded_On = value; }

[JsonProperty("Munique")]
public string Str_munique { get => str_munique; set => str_munique = value; }


public class StoreCollection
{
private List
store1;

public List
Store1 { get => store1; set => store1 = value; }
}

}

public class Program : Store
{


public void GetValues()
{

var layout = JsonConvert.DeserializeObject>(reply);
foreach (var item in layout)
{

//Console.WriteLine("{0}, {1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}",
//item.Munique1, item.Str_Name, item.Str_Address1, item.Str_Address2, item.Str_City, item.Str_St, item.Str_Zip, item.Str_Country, item.Str_Phone, item.Str_Email, item.Str_Retailer,
//item.Str_Banner, item.Str_Status
// );





    myCommand.ExecuteNonQuery();
}


}

}


public static void Main()
{
Program P1 = new Program();
P1.GetValues();
}


}

}













Second Store Data API Pull


The example directly below pulls from a store information API into a database





using System;
using System.Data;
//using Microsoft.SqlServer.Dts.Runtime;
//using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Data.Sql;
using System.Data.SqlClient;
using Newtonsoft.Json;

namespace eLayOutNov18
{

public class Store
{
static WebClient client = new WebClient();
public static string reply = client.DownloadString("https://client.eAFDFt.com/elADFt_retailers_api.php?akey=13523ASDFASDFAD41452525as");

private string Retailer_Id;
private string Name;

[JsonProperty("Retailer_Id")]
public string Retailer_Id1 { get => Retailer_Id; set => Retailer_Id = value; }

[JsonProperty("Name")]
public string Name1 { get => Name; set => Name = value; }

public class StoreCollection
{
private List
store1;
public List
Store1 { get => store1; set => store1 = value; }
}
}

public class Program : Store
{

public void GetValues()
{



public static void Main()
{
Program P1 = new Program();
P1.GetValues();
}
}
}














Legacy VB.NET Code Maintence


The example directly below demonstrates the code I wrote to maintain legacy VB.NET applications





    Imports System.Data
    Imports System.Web.SessionState
    Imports CRM.Framework.BusinessLogic.GenericEntity
    Namespace CRM.Framework.Web.eBusiness
    Partial Class FrenchLocation
    Inherits CRM.Framework.Web.eBusiness.BaseUserControlAdvanced
    Dim oCICAError As CRMGenericEntity

    Public js_Registartion_CheckBoxAlert As String

    'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: added string to store the session variable from the Programs & Exams dropdown in the Education/Registration.aspx page

    Public Current_FrenchWorkshop_Page_Session As String
    Public Current_Registration_Program_Session As String

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

    'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: added session variable to obtain the value selected from the Programs & Exams dropdown in the Registration page.
    'The Current_French_Page_Session string is used as a condition to send the FrenchLocation session variable to the SummarySelectedCourses page.

    Current_FrenchWorkshop_Page_Session = Session("ddl_Registration_Program")
    Current_Registration_Program_Session = Session("ddl_Registration_Program")

    If Session("rbl_Declarations_DeclarConsent") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarRegulations") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarDocumentation") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarAccept") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarOrganization") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarAmin") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarShared") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarAnnualFee") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarEvaluation") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarExam") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestCriminalOffence") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestInvestigation") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestSuspension") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestBankrupt") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestSecurity") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestSociety") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestCertify") IsNot Nothing Then
    Else
    Response.Redirect("~/CustomerService/Profile.aspx", False)
    End If


    If Not IsPostBack Then
    Try

    'lblError.Visible = False
    btn_Registration_Back.Visible = True
    btn_Registration_ProceedToSummary.Visible = True

    'MB: Sept 30, 2021: removed if block so this defaults automatically to French - feature/exam-workshop-locations-self-serve-IT0126732

    'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: added new global variables to update French text

    If Session("FrenchLocationPageLanguageOfInstructionChosenFromRegistrationPage") = "French" Then
    lbl_Registration_Title.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Title.ToString
    lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticEnglish.lbl_Workshop_Text.ToString()
    lbl_FrenchLocation_Location.Text = Resources.CRMAtlanticEnglish.lbl_Location_Select_Text.ToString()
    ddl_FrenchLocation_Location.Items.Insert(0, New ListItem(Resources.CRMAtlanticEnglish.lbl_Location_Select_Prompt_Dropdown_Text.ToString(), "0"))
    btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticEnglish.btn_Registration_ProceedToSummary.ToString()
    btn_Registration_Back.Text = Resources.CRMAtlanticEnglish.btn_Registration_Back.ToString()

    Else
    Me.pcTopicMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_ContactInfo
    Me.pcSubscriptionMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Declarations
    Me.pcEventMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Registration
    lbl_Registration_Title.Text = Resources.CRMAtlanticFrench.lbl_Registration_Title.ToString
    lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Text.ToString()
    lbl_FrenchLocation_Location.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Name_Text.ToString()
    ddl_FrenchLocation_Location.Items.Insert(0, New ListItem(Resources.CRMAtlanticFrench.lbl_FrenchLocation_Select_Text.ToString(), "0"))
    'btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticEnglish.btn_Registration_ProceedToSummary.ToString()
    'btn_Registration_Back.Text = Resources.CRMAtlanticEnglish.btn_Registration_Back.ToString()
    btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticFrench.btn_Registration_ProceedToSummary.ToString()
    btn_Registration_Back.Text = Resources.CRMAtlanticFrench.btn_Registration_Back.ToString()

    End If

    Dim sSQL As String = Nothing
    Dim dt As DataTable = Nothing
    Dim strProgram As String = Nothing

    ddl_FrenchLocation_Location.AppendDataBoundItems = True

    If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then
    strProgram = "2"
    Else
    strProgram = HttpUtility.HtmlEncode(Session("ddl_Registration_Program").ToString.Trim)
    End If

    'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: This query populates the Moncton NB exam center location dropdown on the "FrenchLocation" page
    sSQL = "SELECT [ID], [Value] AS CommonFinalExamDateFR FROM vwentityfieldvalues WHERE EntityID = 1534 AND EntityFieldsID = 18001 AND [Value] IN ('Moncton, NB')"


    dt = Nothing
    dt = DataAction.GetDataTable(sSQL, CRM.Framework.DataServices.ICRMDataAction.DSLCacheSetting.BypassCache)

    ddl_FrenchLocation_Location.DataSource = dt

    ddl_FrenchLocation_Location.DataTextField = "CommonFinalExamDateFR"

    ddl_FrenchLocation_Location.DataValueField = "ID"
    ddl_FrenchLocation_Location.DataBind()

    Catch ex As Exception
    CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity)
    oCICAError.SetValue("EntityLastError", ex.Message)
    oCICAError.SetValue("EntityLastUserError", ex.Message)
    oCICAError.SetValue("ExceptionSource", ex.Source & "-->RegistrationCFE.ascx.vb-->Page_Load()")
    oCICAError.SetValue("ExceptionMessage", ex.Message)
    oCICAError.Save()
    End Try
    Else
    Session("ddl_Registration_Language") = Nothing
    Session("ddl_Registration_Program") = Nothing
    Session("ddl_Registration_Course") = Nothing
    Session("ddl_Registration_Semester") = Nothing
    End If
    End Sub
    Protected Sub proceedButton_Click(sender As Object, e As EventArgs)
    Try
    'Instruct any validation controls included on the page to validate their assigned information.
    'Then verify whether the validation succeeded or not.
    'Exit the sub if validation fails.
    Page.Validate()
    If Not Page.IsValid Then
    Exit Sub
    End If

    'Dim oPersonGE As CRMGenericEntityBase = Nothing
    'oPersonGE = CRMApplication.GetEntityObject("Persons", User1.PersonID)
    'oPersonGE.SetValue("IntendedCFEDate", ddl_RegistrationCFE_Intended_Date.SelectedItem.Text.ToString())
    'oPersonGE.Save()


    'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: once the OnClick "Proceed" button is selected,
    'Current_French_Page_Session checks to see what
    ' Programs & Exams choice was selected from the dropdown on the Education/Registration.aspx page.
    ' The dropdown selected item from this page is then inserted into to another session, namely  Session("French_Location_PageA"),
    ' Session("French_Location_PageB"), or Session("French_Location_PageC").  This value is sent to the SummarySelectedCourses Page.

    If Current_FrenchWorkshop_Page_Session = "1" Then
    Session("French_Location_PageA") = ddl_FrenchLocation_Location.SelectedItem.Text.ToString()
    End If
    If Current_FrenchWorkshop_Page_Session = "11" Then
    Session("French_Location_PageB") = ddl_FrenchLocation_Location.SelectedItem.Text.ToString()
    End If
    If Current_FrenchWorkshop_Page_Session = "8" Then
    Session("French_Location_PageC") = ddl_FrenchLocation_Location.SelectedItem.Text.ToString()
    End If
    If Current_FrenchWorkshop_Page_Session = "7" Then
    Session("French_Location_PageD") = ddl_FrenchLocation_Location.SelectedItem.Text.ToString()
    End If

    'MB: Feb 14, 2021 - this updates the0 current row index
    'based on the Location the user selects.  It then updates
    'CType(Session("summaryDataTable"), DataTable)

    Dim dt As New DataTable
    dt = CType(Session("summaryDataTable"), DataTable)

    If (dt.Rows.Count > 0) Then
    Dim x As Integer = 0
    Dim y As Integer
    For i As Integer = 0 To dt.Rows.Count - 1
    Dim row = dt.Rows(i)
    y = i
    Next

    If Session("French_Location_PageA") IsNot Nothing Then
    dt.Rows(Math.Max(x, y))("Place") = Session("French_Location_PageA").ToString
    End If
    If Session("French_Location_PageB") IsNot Nothing Then
    dt.Rows(Math.Max(x, y))("Place") = Session("French_Location_PageB").ToString
    End If
    If Session("French_Location_PageC") IsNot Nothing Then
    dt.Rows(Math.Max(x, y))("Place") = Session("French_Location_PageC").ToString
    End If
    If Session("French_Location_PageD") IsNot Nothing Then
    dt.Rows(Math.Max(x, y))("Place") = Session("French_Location_PageD").ToString
    End If

    End If


    If Current_Registration_Program_Session = "1" Or Current_Registration_Program_Session = "11" Or Current_Registration_Program_Session = "8" Or Current_Registration_Program_Session = "7" Then
    Session("Current_French_Page_Session_Chosen") = Current_FrenchWorkshop_Page_Session
    Response.Redirect("~/Education/RegistrationCFE.aspx", False)
    '  Session("ddl_Registration_Language_French") = "2"

    Else
    Response.Redirect("~/Education/SummarySelectedCourses.aspx", False)
    End If


    Catch ex As Exception
    CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity)
    oCICAError.SetValue("EntityLastError", ex.Message)
    oCICAError.SetValue("EntityLastUserError", ex.Message)
    oCICAError.SetValue("ExceptionSource", ex.Source & "-->RegistrationCFE.ascx.vb-->proceedButton_Click()")
    oCICAError.SetValue("ExceptionMessage", ex.Message)
    oCICAError.Save()
    End Try

    End Sub

    Protected Sub backButton_Click(sender As Object, e As EventArgs) Handles btn_Registration_Back.Click
    Response.Redirect("Registration.aspx", False)
    'Response.Redirect("~/CustomerService/Profile.aspx", False)
    'Response.Redirect(Page.Request.ApplicationPath)
    End Sub

    End Class
    End Namespace

    ==========================================================================


    Imports System.Data
    Imports System.Web.SessionState
    Imports CRM.Framework.BusinessLogic.GenericEntity
    Namespace CRM.Framework.Web.eBusiness
    Partial Class Location
    Inherits CRM.Framework.Web.eBusiness.BaseUserControlAdvanced
    Dim oCICAError As CRMGenericEntity
    Private m_Language As Integer
    Public js_Registartion_CheckBoxAlert As String

    'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: added string to store the session variable from the Programs & Exams dropdown in the Education/Registration.aspx page
    Public Current_Location_Page_Session As String
    Public Current_Registration_Program_Session As String

    Dim counter As Integer


    Public Property Language As Integer
    Get
    Return m_Language
    End Get
    Set(ByVal value As Integer)
    m_Language = value
    End Set
    End Property

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load


    'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: added session variable to obtain the value
    'selected From the Programs & Exams dropdown in the Registration page.
    'This variable is used as a condition to send the Locations session variable to the SummarySelectedCourses page.

    Current_Location_Page_Session = Session("ddl_Registration_Program")
    Current_Registration_Program_Session = Session("ddl_Registration_Program")

    If Session("rbl_Declarations_DeclarConsent") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarRegulations") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarDocumentation") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarAccept") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarOrganization") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarAmin") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarShared") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarAnnualFee") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarEvaluation") IsNot Nothing AndAlso
    Session("rbl_Declarations_DeclarExam") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestCriminalOffence") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestInvestigation") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestSuspension") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestBankrupt") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestSecurity") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestSociety") IsNot Nothing AndAlso
    Session("rbl_Declarations_AttestCertify") IsNot Nothing Then
    Else
    Response.Redirect("~/CustomerService/Profile.aspx", False)
    End If

    Me.Language = 1
    If Not Session("Language") Is Nothing Then
    Me.Language = CInt(Session("Language"))
    Else
    Dim hfLanguage As HiddenField = DirectCast(Me.Page.Master.FindControl("hfLanguage"), HiddenField)
    If Not hfLanguage Is Nothing Then
    If Not hfLanguage.Value Is Nothing Then
    Me.Language = CInt(hfLanguage.Value)
    End If
    End If
    End If

    If Not IsPostBack Then
    Try

    'lblError.Visible = False
    btn_Registration_Back.Visible = True
    btn_Registration_ProceedToSummary.Visible = True

    If Language = 2 Then

    'Tab titles HP
    'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: added new global variables to update English text

    Me.pcTopicMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_ContactInfo
    Me.pcSubscriptionMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Declarations
    Me.pcEventMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Registration

    lbl_Registration_Title.Text = Resources.CRMAtlanticFrench.lbl_Registration_Title.ToString()
    lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Select_Text.ToString()
    lbl_LocationPage_Location.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Name_Text.ToString()
    ddl_LocationPage_Location.Items.Insert(0, New ListItem(Resources.CRMAtlanticFrench.lbl_FrenchLocation_Select_Text.ToString(), "0"))
    btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticFrench.btn_Registration_ProceedToSummary.ToString()
    btn_Registration_Back.Text = Resources.CRMAtlanticFrench.btn_Registration_Back.ToString()


    'MB: Oct 26, 2021 - added condition for when "CRM PEP" is selected for "Anglais"
    If Language = 2 And Current_Location_Page_Session.ToString() = "2" Then
    lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_CRM_PEP_Select_Anglais_Text.ToString()
    End If
    If Language = 2 And Current_Location_Page_Session.ToString() = "9" Then
    lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_CRM_PEP_Select_Anglais_Text.ToString()
    End If
    If Language = 2 And Current_Location_Page_Session.ToString() = "10" Then
    lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_CRM_PEP_Select_Anglais_Text.ToString()
    End If

    Else
    lbl_Registration_Title.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Title.ToString()
    lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticEnglish.lbl_Location_Text.ToString()
    lbl_LocationPage_Location.Text = Resources.CRMAtlanticEnglish.lbl_Location_Select_Text.ToString()
    ddl_LocationPage_Location.Items.Insert(0, New ListItem(Resources.CRMAtlanticEnglish.lbl_Location_Select_Prompt_Dropdown_Text.ToString(), "0"))
    btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticEnglish.btn_Registration_ProceedToSummary.ToString()
    btn_Registration_Back.Text = Resources.CRMAtlanticEnglish.btn_Registration_Back.ToString()
    End If

    Dim sSQL As String = Nothing
    Dim dt As DataTable = Nothing
    Dim strProgram As String = Nothing

    ddl_LocationPage_Location.AppendDataBoundItems = True

    'If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then
    '    strProgram = "2"
    'Else
    '    strProgram = HttpUtility.HtmlEncode(Session("ddl_Registration_Program").ToString.Trim)
    'End If

    'MB: Oct 22, 2021 'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: updated so dropdowns work based on language selected

    If Language = 1 Then
    sSQL = "Select [ID], [Value] as LocationEN FROM vwentityfieldvalues WHERE EntityID = 1534 And EntityFieldsID = 18001"
    End If

    If Language = 2 Then
    sSQL = "Select [ID], [Value] as LocationFR FROM vwentityfieldvalues WHERE EntityID = 1534 And EntityFieldsID = 18001"
    End If

    dt = Nothing
    dt = DataAction.GetDataTable(sSQL, CRM.Framework.DataServices.ICRMDataAction.DSLCacheSetting.BypassCache)

    ddl_LocationPage_Location.DataSource = dt
    If Language = 2 Then
    ddl_LocationPage_Location.DataTextField = "LocationFR"
    Else
    ddl_LocationPage_Location.DataTextField = "LocationEN"
    End If

    ddl_LocationPage_Location.DataValueField = "ID"
    ddl_LocationPage_Location.DataBind()

    Catch ex As Exception
    CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity)
    oCICAError.SetValue("EntityLastError", ex.Message)
    oCICAError.SetValue("EntityLastUserError", ex.Message)
    oCICAError.SetValue("ExceptionSource", ex.Source & "-->RegistrationCFE.ascx.vb-->Page_Load()")
    oCICAError.SetValue("ExceptionMessage", ex.Message)
    oCICAError.Save()
    End Try
    Else
    'Session("ddl_Registration_Language") = Nothing
    'Session("ddl_Registration_Program") = Nothing
    'Session("ddl_Registration_Course") = Nothing
    'Session("ddl_Registration_Semester") = Nothing
    End If
    End Sub
    Protected Sub proceedButton_Click(sender As Object, e As EventArgs)
    Try
    'Instruct any validation controls included on the page to validate their assigned information.
    'Then verify whether the validation succeeded or not.
    'Exit the sub if validation fails.
    Page.Validate()
    If Not Page.IsValid Then
    Exit Sub
    End If

    'Dim oPersonGE As CRMGenericEntityBase = Nothing
    'oPersonGE = CRMApplication.GetEntityObject("Persons", User1.PersonID)
    'oPersonGE.SetValue("IntendedCFEDate", ddl_RegistrationCFE_Intended_Date.SelectedItem.Text.ToString())
    'oPersonGE.Save()

    'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: once the OnClick "Proceed" button is selected,
    'Current_Location_Page_Session checks to see what
    ' Programs & Exams choice was selected from the dropdown on the Education/Registration.aspx page.
    ' The dropdown selected item from this page is then inserted into to another session, namely  Session("Location_PageA"),
    ' Session("Location_PageB"), or Session("Location_PageC").  This value is sent to the SummarySelectedCourses Page.

    If Current_Location_Page_Session = "2" Then
    Session("Location_PageA") = ddl_LocationPage_Location.SelectedItem.Text.ToString()
    End If
    If Current_Location_Page_Session = "10" Then
    Session("Location_PageB") = ddl_LocationPage_Location.SelectedItem.Text.ToString()
    End If
    If Current_Location_Page_Session = "9" Then
    Session("Location_PageC") = ddl_LocationPage_Location.SelectedItem.Text.ToString()
    End If

    'MB: Feb 14, 2021 - this updates the0 current row index
    'based on the Location the user selects.  It then updates
    'CType(Session("summaryDataTable"), DataTable)

    Dim dt As New DataTable
    dt = CType(Session("summaryDataTable"), DataTable)

    If (dt.Rows.Count > 0) Then
    Dim x As Integer = 0
    Dim y As Integer
    For i As Integer = 0 To dt.Rows.Count - 1
    Dim row = dt.Rows(i)
    y = i
    Next

    If Session("Location_PageA") IsNot Nothing Then
    dt.Rows(Math.Max(x, y))("Place") = Session("Location_PageA").ToString
    End If
    If Session("Location_PageB") IsNot Nothing Then
    dt.Rows(Math.Max(x, y))("Place") = Session("Location_PageB").ToString
    End If
    If Session("Location_PageC") IsNot Nothing Then
    dt.Rows(Math.Max(x, y))("Place") = Session("Location_PageC").ToString
    End If

    End If

    'MB: Oct 20, 2021 - feature/exam-workshop-locations-self-serve-IT0126732:
    'redirects to Education/RegistrationCFE.aspx if category PREP is selected

    If Current_Registration_Program_Session = "2" Then
    Response.Redirect("~/Education/RegistrationPrepCourse.aspx", False)
    Else
    Response.Redirect("~/Education/SummarySelectedCourses.aspx", False)
    End If

    Catch ex As Exception
    CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity)
    oCICAError.SetValue("EntityLastError", ex.Message)
    oCICAError.SetValue("EntityLastUserError", ex.Message)
    oCICAError.SetValue("ExceptionSource", ex.Source & "-->RegistrationCFE.ascx.vb-->proceedButton_Click()")
    oCICAError.SetValue("ExceptionMessage", ex.Message)
    oCICAError.Save()
    End Try

    End Sub

    Protected Sub backButton_Click(sender As Object, e As EventArgs) Handles btn_Registration_Back.Click
    Response.Redirect("Registration.aspx", False)
    'Response.Redirect("~/CustomerService/Profile.aspx", False)
    'Response.Redirect(Page.Request.ApplicationPath)
    End Sub

    End Class
    End Namespace


    ==================================================


    Imports System.Data
    Imports System.Web.SessionState
    Imports CRM.Framework.BusinessLogic.GenericEntity
    Namespace CRM.Framework.Web.eBusiness
    Partial Class Registration
    Inherits CRM.Framework.Web.eBusiness.BaseUserControlAdvanced
    Dim oCICAError As CRMGenericEntity
    Private m_Language As Integer
    Private examDateSummaryColumn As String = "ExamDate"
    Public js_Registartion_CheckBoxAlert As String
    Private semesterValues As New List(Of String)

    'This is the same indexing that needs to be applied to all the SQL queries relating to the cascaded program dropdown menu which based on the vwcurriculumDefinitions view
    Private indexSQLvwcurriculumDefinitions As String = "ORDER BY (" _
    & " CASE WHEN ID = 2 THEN 1" _
    & " WHEN ID = 10 THEN 2" _
    & " WHEN ID = 9 THEN 3" _
    & " WHEN ID = 1 THEN 4" _
    & " WHEN ID = 11 THEN 5 " _
    & " WHEN ID = 8 THEN 6" _
    & " WHEN ID = 7 THEN 7" _
    & " END );"

    Public Property Language As Integer
    Get
    Return m_Language
    End Get
    Set(ByVal value As Integer)
    m_Language = value
    End Set
    End Property
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load


    If Session("rbl_Declarations_DeclarConsent") IsNot Nothing AndAlso _
    Session("rbl_Declarations_DeclarRegulations") IsNot Nothing AndAlso _
    Session("rbl_Declarations_DeclarDocumentation") IsNot Nothing AndAlso _
    Session("rbl_Declarations_DeclarAccept") IsNot Nothing AndAlso _
    Session("rbl_Declarations_DeclarOrganization") IsNot Nothing AndAlso _
    Session("rbl_Declarations_DeclarAmin") IsNot Nothing AndAlso _
    Session("rbl_Declarations_DeclarShared") IsNot Nothing AndAlso _
    Session("rbl_Declarations_DeclarAnnualFee") IsNot Nothing AndAlso _
    Session("rbl_Declarations_DeclarEvaluation") IsNot Nothing AndAlso _
    Session("rbl_Declarations_DeclarExam") IsNot Nothing AndAlso _
    Session("rbl_Declarations_AttestCriminalOffence") IsNot Nothing AndAlso _
    Session("rbl_Declarations_AttestInvestigation") IsNot Nothing AndAlso _
    Session("rbl_Declarations_AttestSuspension") IsNot Nothing AndAlso _
    Session("rbl_Declarations_AttestBankrupt") IsNot Nothing AndAlso _
    Session("rbl_Declarations_AttestSecurity") IsNot Nothing AndAlso _
    Session("rbl_Declarations_AttestSociety") IsNot Nothing AndAlso _
    Session("rbl_Declarations_AttestCertify") IsNot Nothing Then
    Else
    Response.Redirect("~/CustomerService/Profile.aspx", False)
    End If

    Dim sSQLclasses As String = Nothing
    Dim dtclasses As DataTable = Nothing

    'Dim l As Long = User1.PersonID
    'User1.PersonID = CType(Session("PersonID"), Long)

    grdMyClasses.DataSource = Nothing
    grdMyClasses.Focus()

    Me.Language = 1
    If Not Session("Language") Is Nothing Then
    Me.Language = CInt(Session("Language"))
    Else
    Dim hfLanguage As HiddenField = DirectCast(Me.Page.Master.FindControl("hfLanguage"), HiddenField)
    If Not hfLanguage Is Nothing Then
    If Not hfLanguage.Value Is Nothing Then
    Me.Language = CInt(hfLanguage.Value)
    End If
    End If
    End If

    If Not IsPostBack Then
    Try

    'lblError.Visible = False
    btn_Registration_Back.Visible = False
    btn_Registration_ProceedToSummary.Visible = False

    If Language = 2 Then

    'Tab titles HP
    Me.pcTopicMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_ContactInfo
    Me.pcSubscriptionMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Declarations
    Me.pcEventMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Registration

    'Load ddl_Registration_Language
    ddl_Registration_Language.Items.Insert(0, New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Language.ToString(), "0"))
    ddl_Registration_Language.Items.Insert(1, New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_English_Language.ToString(), "1"))
    ddl_Registration_Language.Items.Insert(2, New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_French_Language.ToString(), "2"))
    'Load ddl_Registration_Program
    ddl_Registration_Program.Items.Insert(0, New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Program.ToString(), "0"))
    'Load ddl_Registration_Course
    ddl_Registration_Course.Items.Insert(0, New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Course.ToString(), "0"))
    'Load ddl_Registration_Semester
    ddl_Registration_Semester.Items.Insert(0, New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Semester.ToString(), "0"))

    lbl_ContactInfo_Title.Text = Resources.CRMAtlanticFrench.lbl_ContactInfo_Title
    lbl_Registration_SelectMessage.Text = Resources.CRMAtlanticFrench.lbl_Registration_SelectMessage.ToString()
    lbl_Registration_Language.Text = Resources.CRMAtlanticFrench.lbl_Registration_Language.ToString()
    lbl_Registration_Program.Text = Resources.CRMAtlanticFrench.lbl_Registration_Program.ToString()
    lbl_Registration_Course.Text = Resources.CRMAtlanticFrench.lbl_Registration_Course.ToString()
    lbl_Registration_Semester.Text = Resources.CRMAtlanticFrench.lbl_Registration_Semester.ToString()
    lbl_Registration_Message.Text = Resources.CRMAtlanticFrench.lbl_Registration_Message.ToString()
    btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticFrench.btn_Registration_ProceedToSummary.ToString()
    btn_Registration_Back.Text = Resources.CRMAtlanticFrench.btn_Registration_Back.ToString()
    lbl_Registration_Title.Text = Resources.CRMAtlanticFrench.lbl_Registration_Title.ToString
    'Grid
    grdMyClasses.Columns("0").HeaderText = Resources.CRMAtlanticFrench.gd_Registrations_Header_Language
    grdMyClasses.Columns("1").HeaderText = Resources.CRMAtlanticFrench.gd_Registration_Header_Program
    grdMyClasses.Columns("2").HeaderText = Resources.CRMAtlanticFrench.gd_Registration_Header_Course
    grdMyClasses.Columns("3").HeaderText = Resources.CRMAtlanticFrench.gd_Registration_Header_Location
    grdMyClasses.Columns("4").HeaderText = Resources.CRMAtlanticFrench.gd_Registration_Header_StartDate
    grdMyClasses.Columns("5").HeaderText = Resources.CRMAtlanticFrench.gd_Registration_Header_EndDate
    grdMyClasses.Columns("6").HeaderText = Resources.CRMAtlanticFrench.gd_Registration_Header_RegistrationCloses
    grdMyClasses.Columns("9").HeaderText = Resources.CRMAtlanticFrench.gd_Registration_Header_Purchase

    Dim lbl_Loading_Wait_Msg As Label
    lbl_Loading_Wait_Msg = DirectCast(updateProcessingIndicator.Controls(0).FindControl("lblLoading"), Label)
    lbl_Loading_Wait_Msg.Text = Resources.CRMAtlanticFrench.lblLoading

    js_Registartion_CheckBoxAlert = Resources.CRMAtlanticFrench.js_Registartion_CheckBoxAlert



    Else
    'Load ddl_Registration_Language
    ddl_Registration_Language.Items.Insert(0, New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Language.ToString(), "0"))
    ddl_Registration_Language.Items.Insert(1, New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_English_Language.ToString(), "1"))
    ddl_Registration_Language.Items.Insert(2, New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_French_Language.ToString(), "2"))
    'Load ddl_Registration_Program
    ddl_Registration_Program.Items.Insert(0, New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Program.ToString(), "0"))
    'Load ddl_Registration_Course
    ddl_Registration_Course.Items.Insert(0, New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Course.ToString(), "0"))
    'Load ddl_Registration_Semester
    ddl_Registration_Semester.Items.Insert(0, New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Semester.ToString(), "0"))

    lbl_ContactInfo_Title.Text = Resources.CRMAtlanticEnglish.lbl_ContactInfo_Title
    lbl_Registration_SelectMessage.Text = Resources.CRMAtlanticEnglish.lbl_Registration_SelectMessage.ToString()
    lbl_Registration_Language.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Language.ToString()
    lbl_Registration_Program.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Program.ToString()
    lbl_Registration_Course.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Course.ToString()
    lbl_Registration_Semester.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Semester.ToString()
    lbl_Registration_Message.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Message.ToString()
    btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticEnglish.btn_Registration_ProceedToSummary.ToString()
    btn_Registration_Back.Text = Resources.CRMAtlanticEnglish.btn_Registration_Back.ToString()
    lbl_Registration_Title.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Title.ToString
    'Grid
    grdMyClasses.Columns("0").HeaderText = Resources.CRMAtlanticEnglish.gd_Registrations_Header_Language
    grdMyClasses.Columns("1").HeaderText = Resources.CRMAtlanticEnglish.gd_Registration_Header_Program
    grdMyClasses.Columns("2").HeaderText = Resources.CRMAtlanticEnglish.gd_Registration_Header_Course
    grdMyClasses.Columns("3").HeaderText = Resources.CRMAtlanticEnglish.gd_Registration_Header_Location
    grdMyClasses.Columns("4").HeaderText = Resources.CRMAtlanticEnglish.gd_Registration_Header_StartDate
    grdMyClasses.Columns("5").HeaderText = Resources.CRMAtlanticEnglish.gd_Registration_Header_EndDate
    grdMyClasses.Columns("6").HeaderText = Resources.CRMAtlanticEnglish.gd_Registration_Header_RegistrationCloses
    grdMyClasses.Columns("9").HeaderText = Resources.CRMAtlanticEnglish.gd_Registration_Header_Purchase

    Dim lbl_Loading_Wait_Msg As Label
    lbl_Loading_Wait_Msg = DirectCast(updateProcessingIndicator.Controls(0).FindControl("lblLoading"), Label)
    lbl_Loading_Wait_Msg.Text = Resources.CRMAtlanticEnglish.lblLoading

    js_Registartion_CheckBoxAlert = Resources.CRMAtlanticEnglish.js_Registartion_CheckBoxAlert
    End If

    'Populate ddl_Registration_Language
    populateLanguage()

    'sSQL = "Select * from " + CRMApplication.GetEntityBaseDatabase("Program Progress") + "..vwAtlanticSchoolProgramProgress__c WHERE ApplicantID=" + User1.PersonID
    'sSQL = "Select vc.Name, vc.ID,vc.WebDescription, vAtPP.Applicant,vAtPP.Curriculum from vwAtlanticSchoolProgramProgress__c vAtPP, vwcourses vc where vc.category = vAtPP.Curriculum And vAtPP.ApplicantID=" + User1.PersonID;
    'sSQL = "Select vc.Name, vc.ID,vc.WebDescription,vAtPP.Applicant,vAtPP.Curriculum from vwAtlanticSchoolProgramProgress__c vAtPP, vwcourses vc where vc.category = vAtPP.Curriculum And vAtPP.ApplicantID = " + User1.PersonID + " And vc.ID Not In (Select vcr.CourseID from vwclassregistrations vcr where vcr.status = 'Failed' and vcr.studentid = " + User1.PersonID + ")";
    'Following was good until Prereq requirement
    'sSQL = "select Format(vpp.price, 'C', 'en-CA') As Price, vc.Name, vc.ID as CourseId,vc.WebDescription,vAtPP.Applicant,vps.Prefix,vps.FirstName,vps.LastName,UPPER(vAtPP.Curriculum) as Curriculum,vcl.ClassName,vcl.ID as ClassId, vcl.ProductID, CASE WHEN (LEN(ltrim(rtrim(vcl.Place))) = 0) THEN 'Vancouver' ELSE vcl.Place END AS Place, CONVERT(varchar(10), vcl.StartDate, 101) as StartDate, CONVERT(varchar(10), vcl.EndDate, 101) as EndDate from vwAtlanticSchoolProgramProgress__c vAtPP, vwcourses vc, vwClasses vcl, vwproductprices vpp, vwpersons vps where vAtPP.ApplicantID = vps.ID and vc.category = vAtPP.Curriculum and vAtPP.ApplicantID = " & User1.PersonID & " and vpp.MemberTypeID = 5 and vpp.ProductID = vcl.ProductID and year(vcl.StartDate) = year(GetDate()) and month(vcl.StartDate) >= month(GetDate()) and vcl.Courseid = vc.id and vc.ID not in (select vcr.CourseID from vwclassregistrations vcr where vcr.status = 'Passed' and vcr.studentid = " & User1.PersonID & ") order By CASE vc.NAME 	When 'Module 1: Intro Financial Accounting' THEN 1	When 'Module 2: Intro Management Accounting' THEN 2	When 'Module 3: Economics' THEN 3	When 'Module 4: Statistics' THEN 4	When 'Module 5: Financial Accounting' THEN 5	When 'Module 6: Corporate Finance' THEN 6	When 'Module 7: Audit and Assurance' THEN 7	When 'Module 8: Tax' THEN 8	When 'Module 9: Management Accounting' THEN 9	When 'Module 10: Strategy and Governance' THEN 10	When 'Module 11: Business Law' THEN 11	When 'Module 12: IT' THEN 12 End"
    'Following was good until Year and Month of vcl.startdate requirement
    'sSQL = "select Format(vpp.price, 'C', 'en-CA') As Price, vc.Name, vc.ID as CourseId,vc.WebDescription,vAtPP.Applicant,vps.Prefix,vps.FirstName,vps.LastName,UPPER(vAtPP.Curriculum) as Curriculum,vcl.ClassName,vcl.ID as ClassId, vcl.ProductID, CASE WHEN (LEN(ltrim(rtrim(vcl.Place))) = 0) THEN 'Vancouver' ELSE vcl.Place END AS Place, CONVERT(varchar(10), vcl.StartDate, 101) as StartDate, CONVERT(varchar(10), vcl.EndDate, 101) as EndDate from vwAtlanticSchoolProgramProgress__c vAtPP, vwcourses vc, vwClasses vcl, vwproductprices vpp, vwpersons vps where vAtPP.ApplicantID = vps.ID and vc.category = vAtPP.Curriculum and vAtPP.ApplicantID = " & User1.PersonID & " and vpp.MemberTypeID = 5 and vpp.ProductID = vcl.ProductID and year(vcl.StartDate) between year(GetDate()) and DATEPART(year,dateadd(year, +1, getdate())) and month(vcl.StartDate) >= month(GetDate()) and vcl.Courseid = vc.id and vc.ID not in (select vcr.CourseID from vwclassregistrations vcr where vcr.status = 'Passed' and vcr.studentid = " & User1.PersonID & ") and (vc.ID in (Select courseID from vwCoursePreReqs group by CourseID having count(courseID) = (select count(courseId) from vwclassregistrations  vcr where vcr.status in ('Passed','Registered') and vcr.studentid = '7104')) OR vc.id not in(select courseID from vwCoursePreReqs )) order By CASE vc.NAME When 'Module 1: Intro Financial Accounting' THEN 1 When 'Module 2: Intro Management Accounting' THEN 2 When 'Module 3: Economics' THEN 3 When 'Module 4: Statistics' THEN 4 When 'Module 5: Financial Accounting' THEN 5 When 'Module 6: Corporate Finance' THEN 6 When 'Module 7: Audit and Assurance' THEN 7 When 'Module 8: Tax' THEN 8 When 'Module 9: Management Accounting' THEN 9 When 'Module 10: Strategy and Governance' THEN 10 When 'Module 11: Business Law' THEN 11 When 'Module 12: IT' THEN 12 End"
    'sSQL = "Select MemberTypeID from vwpersons where ID =" & User1.PersonID
    'dt = DataAction.GetDataTable(sSQL, CRM.Framework.DataServices.ICRMDataAction.DSLCacheSetting.BypassCache)
    'If dt.Rows.Count > 0 Then
    '    If dt.Rows(0)("MemberTypeID") = 16 Then
    '        Me.lblError.Visible = True
    '        sSQL = ""
    '        dt = Nothing

    '        Exit Sub
    '    Else
    '        Me.lblError.Visible = False
    '    End If
    'End If
    If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then

    Else
    ddl_Registration_Language_SelectedIndexChanged(ddl_Registration_Language, EventArgs.Empty)
    ddl_Registration_Program_SelectedIndexChanged(ddl_Registration_Program, EventArgs.Empty)
    ddl_Registration_Course_SelectedIndexChanged(ddl_Registration_Course, EventArgs.Empty)
    ddl_Registration_Semester_SelectedIndexChanged(ddl_Registration_Semester, EventArgs.Empty)
    End If

    Catch ex As Exception
    CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity)
    oCICAError.SetValue("EntityLastError", ex.Message)
    oCICAError.SetValue("EntityLastUserError", ex.Message)
    oCICAError.SetValue("ExceptionSource", ex.Source & "-->Registration.ascx.vb-->Page_Load()")
    oCICAError.SetValue("ExceptionMessage", ex.Message)
    oCICAError.Save()
    End Try
    Else
    Session("ddl_Registration_Language") = Nothing
    Session("ddl_Registration_Program") = Nothing
    Session("ddl_Registration_Course") = Nothing
    Session("ddl_Registration_Semester") = Nothing

    End If
    End Sub
    Protected Sub populateLanguage()
    Try
    Dim sSQL As String = Nothing
    Dim dt As DataTable = Nothing
    'Populate ddl_Registration_Language
    ddl_Registration_Language.SelectedValue = Language
    'ddl_Registration_Language.SelectedValue = 1
    'Populate ddl_DisplayMyCourses_Language
    ddl_Registration_Language.AppendDataBoundItems = True

    'Populate ddl_DisplayMyCourses_Program
    ddl_Registration_Program.AppendDataBoundItems = True

    If Language = 2 Then
    sSQL = "select ID, Description from vwcurriculumDefinitions where IsFrench = 1" & indexSQLvwcurriculumDefinitions
    Else
    sSQL = "select ID, Name from vwcurriculumDefinitions where IsEnglish = 1" & indexSQLvwcurriculumDefinitions
    End If

    dt = Nothing
    dt = DataAction.GetDataTable(sSQL, CRM.Framework.DataServices.ICRMDataAction.DSLCacheSetting.BypassCache)

    ddl_Registration_Program.DataSource = dt
    If Language = 2 Then
    ddl_Registration_Program.DataTextField = "Description"
    Else
    ddl_Registration_Program.DataTextField = "Name"
    End If

    ddl_Registration_Program.DataValueField = "ID"
    ddl_Registration_Program.DataBind()


    If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then

    Else
    'If Session("ddl_Registration_Language") <> ddl_Registration_Language.SelectedItem.Value Then
    '    ddl_Registration_Course.Items.Clear()
    '    ddl_Registration_Course.Items.Add(New ListItem("--Select Course--", ""))
    '    ddl_Registration_Semester.Items.Clear()
    '    ddl_Registration_Semester.Items.Add(New ListItem("--Select Semester--", ""))
    'Else
    ddl_Registration_Language.SelectedValue = Session("ddl_Registration_Language")
    'End If
    End If

    Session("LanguageOfInstructionChosenFromRegistrationPage") = ddl_Registration_Language.SelectedItem.Value
    Session("FrenchLocationPageLanguageOfInstructionChosenFromRegistrationPage") = ddl_Registration_Language.SelectedItem.Text

    Catch ex As Exception
    CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity)
    oCICAError.SetValue("EntityLastError", ex.Message)
    oCICAError.SetValue("EntityLastUserError", ex.Message)
    oCICAError.SetValue("ExceptionSource", ex.Source & "-->Registration.ascx.vb-->populateLanguage()")
    oCICAError.SetValue("ExceptionMessage", ex.Message)
    oCICAError.Save()
    End Try
    End Sub


    Protected Sub ddl_Registration_Language_SelectedIndexChanged(sender As Object, e As EventArgs)
    Try
    ddl_Registration_Program.Items.Clear()
    'ddl_Registration_Program.Items.Add(New ListItem("--Select Program--", ""))
    ddl_Registration_Course.Items.Clear()
    'ddl_Registration_Course.Items.Add(New ListItem("--Select Course--", ""))
    ddl_Registration_Semester.Items.Clear()
    'ddl_Registration_Semester.Items.Add(New ListItem("--Select Semester--", ""))
    If Language = 2 Then
    'Load ddl_Registration_Program
    ddl_Registration_Program.Items.Add(New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Program.ToString(), "0"))
    'Load ddl_Registration_Course
    ddl_Registration_Course.Items.Add(New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Course.ToString(), "0"))
    'Load ddl_Registration_Semester
    ddl_Registration_Semester.Items.Add(New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Semester.ToString(), "0"))
    Else
    'Load ddl_Registration_Program
    ddl_Registration_Program.Items.Add(New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Program.ToString(), "0"))
    'Load ddl_Registration_Course
    ddl_Registration_Course.Items.Add(New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Course.ToString(), "0"))
    'Load ddl_Registration_Semester
    ddl_Registration_Semester.Items.Add(New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Semester.ToString(), "0"))
    End If
    grdMyClasses.DataSource = Nothing
    grdMyClasses.DataBind()

    lbl_Registration_Message.Visible = False
    btn_Registration_ProceedToSummary.Visible = False
    btn_Registration_Back.Visible = False

    'Populate ddl_DisplayMyCourses_Program
    ddl_Registration_Program.AppendDataBoundItems = True
    Dim sSQL As String = Nothing


    If ddl_Registration_Language.SelectedItem.Value = "2" Then 'LanguageID = 2 Then
    'HP July 13th 2016:Registration: English website - french courses. English languae of courses instead of French
    If Me.Language = 2 Then
    sSQL = "select ID, Description from vwcurriculumDefinitions where IsFrench = 1" & indexSQLvwcurriculumDefinitions
    Else
    sSQL = "select ID, Name  from vwcurriculumDefinitions where IsFrench = 1" & indexSQLvwcurriculumDefinitions
    End If
    Else
    'HP July 18th 2016:Registration: French website - English courses. French language of courses instead of English
    If Language = 2 Then
    sSQL = "select ID, Description from vwcurriculumDefinitions where isEnglish = 1" & indexSQLvwcurriculumDefinitions
    Else
    sSQL = "select ID, Name from vwcurriculumDefinitions where IsEnglish = 1" & indexSQLvwcurriculumDefinitions
    End If

    End If

    Dim dt As DataTable = Nothing
    dt = DataAction.GetDataTable(sSQL, CRM.Framework.DataServices.ICRMDataAction.DSLCacheSetting.BypassCache)

    ddl_Registration_Program.DataSource = dt

    'HP July 13th 2016:Registration: English website - french courses. English languae of courses instead of French
    'If ddl_Registration_Language.SelectedItem.Value = "2" Then 'LanguageID = 2 Then
    If Me.Language = 2 Then
    ddl_Registration_Program.DataTextField = "Description"
    Else
    ddl_Registration_Program.DataTextField = "Name"
    End If

    ddl_Registration_Program.DataValueField = "ID"
    ddl_Registration_Program.DataBind()

    Session("LanguageOfInstructionChosenFromRegistrationPage") = ddl_Registration_Language.SelectedItem.Value
    Session("FrenchLocationPageLanguageOfInstructionChosenFromRegistrationPage") = ddl_Registration_Language.SelectedItem.Text

    If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then

    Else
    'If Session("ddl_Registration_Language") <> ddl_Registration_Language.SelectedItem.Value Then
    '    ddl_Registration_Course.Items.Clear()
    '    ddl_Registration_Course.Items.Add(New ListItem("--Select Course--", ""))
    '    ddl_Registration_Semester.Items.Clear()
    '    ddl_Registration_Semester.Items.Add(New ListItem("--Select Semester--", ""))
    'Else
    ddl_Registration_Program.SelectedValue = Session("ddl_Registration_Program")
    'End If
    End If



    Catch ex As Exception
    CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity)
    oCICAError.SetValue("EntityLastError", ex.Message)
    oCICAError.SetValue("EntityLastUserError", ex.Message)
    oCICAError.SetValue("ExceptionSource", ex.Source & "-->Registration.ascx.vb-->ddl_Registration_Language_SelectedIndexChanged()")
    oCICAError.SetValue("ExceptionMessage", ex.Message)
    oCICAError.Save()
    End Try
    End Sub
    Protected Sub ddl_Registration_Program_SelectedIndexChanged(sender As Object, e As EventArgs)
    Try

    ddl_Registration_Course.Items.Clear()
    'ddl_Registration_Course.Items.Add(New ListItem("--Select Course--", ""))
    ddl_Registration_Semester.Items.Clear()
    'ddl_Registration_Semester.Items.Add(New ListItem("--Select Semester--", ""))
    If Language = 2 Then
    'Load ddl_Registration_Course
    ddl_Registration_Course.Items.Add(New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Course.ToString(), "0"))
    'Load ddl_Registration_Semester
    ddl_Registration_Semester.Items.Add(New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Semester.ToString(), "0"))
    Else
    'Load ddl_Registration_Course
    ddl_Registration_Course.Items.Add(New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Course.ToString(), "0"))
    'Load ddl_Registration_Semester
    ddl_Registration_Semester.Items.Add(New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Semester.ToString(), "0"))
    End If

    grdMyClasses.DataSource = Nothing
    grdMyClasses.DataBind()

    lbl_Registration_Message.Visible = False
    btn_Registration_ProceedToSummary.Visible = False
    btn_Registration_Back.Visible = False


    ddl_Registration_Course.AppendDataBoundItems = True

    Dim sSQL As String = Nothing
    Dim strProgram As String = Nothing

    If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then
    strProgram = HttpUtility.HtmlEncode(ddl_Registration_Program.SelectedItem.Value)
    Else
    strProgram = Session("ddl_Registration_Program").ToString.Trim
    End If

    Dim programIdParam As Data.IDataParameter = Me.DataAction.GetDataParameter("ProgramID", SqlDbType.BigInt, strProgram)
    If ddl_Registration_Language.SelectedItem.Value = "2" Then 'LanguageID = 2 Then
    'HP July 13th 2016:Registration: English website - french courses. English languae of courses instead of French
    If Language = 2 Then
    sSQL = "Select vc.CategoryID, vc.ID, vc.Description from vwcourses vc, vwCurriculumCourseCat vccc where vccc.CategoryID = vc.CategoryID And vccc.CurriculumID =ProgramID order by vc.sequence"
    Else
    sSQL = "select vc.CategoryID, vc.ID, vc.Name from vwcourses vc, vwCurriculumCourseCat vccc where vccc.CategoryID = vc.CategoryID and vccc.CurriculumID =ProgramID order by vc.sequence"
    End If
    Else
    'HP July 18th 2016:Registration: French website - English courses. French language of courses instead of English
    If Language = 2 Then
    sSQL = "select vc.CategoryID, vc.ID, vc.Description from vwcourses vc, vwCurriculumCourseCat vccc where vccc.CategoryID = vc.CategoryID and vccc.CurriculumID =ProgramID order by vc.sequence"
    Else
    sSQL = "select vc.CategoryID, vc.ID, vc.Name from vwcourses vc, vwCurriculumCourseCat vccc where vccc.CategoryID = vc.CategoryID and vccc.CurriculumID =ProgramID order by vc.sequence"
    End If

    End If

    Dim dt As DataTable = Nothing
    dt = DataAction.GetDataTableParametrized(sSQL, CommandType.Text, {programIdParam})

    ddl_Registration_Course.DataSource = dt
    If ddl_Registration_Language.SelectedItem.Value = "2" Then 'LanguageID = 2 Then
    'HP July 13th 2016:Registration: English website - french courses. English languae of courses instead of French
    If Language = 2 Then
    ddl_Registration_Course.DataTextField = "Description"
    Else
    ddl_Registration_Course.DataTextField = "Name"
    End If

    Else
    'HP July 18th 2016:Registration: French website - English courses. French language of courses instead of English
    If Language = 2 Then
    ddl_Registration_Course.DataTextField = "Description"
    Else
    ddl_Registration_Course.DataTextField = "Name"
    End If

    End If

    ddl_Registration_Course.DataValueField = "ID"
    ddl_Registration_Course.DataBind()

    If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then

    Else
    ddl_Registration_Course.SelectedValue = Session("ddl_Registration_Course")
    End If
    Catch ex As Exception
    CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity)
    oCICAError.SetValue("EntityLastError", ex.Message)
    oCICAError.SetValue("EntityLastUserError", ex.Message)
    oCICAError.SetValue("ExceptionSource", ex.Source & "-->Registration.ascx.vb-->ddl_Registration_Program_SelectedIndexChanged()")
    oCICAError.SetValue("ExceptionMessage", ex.Message)
    oCICAError.Save()
    End Try
    End Sub
    Protected Sub ddl_Registration_Course_SelectedIndexChanged(sender As Object, e As EventArgs)
    Try
    ddl_Registration_Semester.Items.Clear()
    'ddl_Registration_Semester.Items.Add(New ListItem("--Select Semester--", ""))

    If Language = 2 Then
    'Load ddl_Registration_Semester
    ddl_Registration_Semester.Items.Add(New ListItem(Resources.CRMAtlanticFrench.ddl_Registration_ListItem_Semester.ToString(), "0"))
    Else
    'Load ddl_Registration_Semester
    ddl_Registration_Semester.Items.Add(New ListItem(Resources.CRMAtlanticEnglish.ddl_Registration_ListItem_Semester.ToString(), "0"))
    End If


    grdMyClasses.DataSource = Nothing
    grdMyClasses.DataBind()

    lbl_Registration_Message.Visible = False
    btn_Registration_ProceedToSummary.Visible = False
    btn_Registration_Back.Visible = False


    ddl_Registration_Semester.AppendDataBoundItems = True

    Dim sSQL As String = Nothing
    Dim strCourse As String = Nothing

    If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then
    strCourse = HttpUtility.HtmlEncode(ddl_Registration_Course.SelectedItem.Value)
    Else
    strCourse = Session("ddl_Registration_Course").ToString.Trim
    End If

    ddl_Registration_Semester.DataTextField = "SeasonEnglish"
    Dim courseIdParam As Data.IDataParameter = Me.DataAction.GetDataParameter("CourseID", SqlDbType.BigInt, strCourse)

    If ddl_Registration_Language.SelectedItem.Value = "2" Then 'LanguageID = 2 Then
    'HP July 13th 2016:Registration: English website - french courses. English languae of courses instead of French
    If Language = 2 Then
    sSQL = "select distinct SeasonFrench from vwClasses where startdate between Getdate() and (Getdate()+365) and courseid = CourseID and LEN(SeasonFrench) >0 "
    Else
    sSQL = "select distinct SeasonEnglish from vwClasses where startdate between Getdate() and (Getdate()+365) and courseid =CourseID and LEN(SeasonEnglish) >0 "
    End If
    Else
    'HP July 18th 2016:Registration: French website - English courses. French language of courses instead of English
    If Language = 2 Then
    sSQL = "select distinct SeasonFrench from vwClasses where startdate between Getdate() and (Getdate()+365) and courseid =CourseID and LEN(SeasonFrench) >0 "
    Else
    sSQL = "select distinct SeasonEnglish from vwClasses where startdate between Getdate() and (Getdate()+365) and courseid =CourseID and LEN(SeasonEnglish) >0 "
    End If

    End If

    Dim dt As DataTable = Nothing
    dt = DataAction.GetDataTableParametrized(sSQL, CommandType.Text, {courseIdParam})

    ddl_Registration_Semester.DataSource = dt
    If ddl_Registration_Language.SelectedItem.Value = "2" Then 'LanguageID = 2 Then
    'HP July 13th 2016:Registration: English website - french courses. English languae of courses instead of French
    If Language = 2 Then
    ddl_Registration_Semester.DataTextField = "SeasonFrench"
    semesterValues =  dt.AsEnumerable().Select(Function(t) HttpUtility.HtmlEncode(t.Item("SeasonFrench").ToString)).ToList()
    Else
    ddl_Registration_Semester.DataTextField = "SeasonEnglish"
    semesterValues =  dt.AsEnumerable().Select(Function(t) HttpUtility.HtmlEncode(t.Item("SeasonEnglish").ToString)).ToList()
    End If

    Else
    'HP July 18th 2016:Registration: French website - English courses. French language of courses instead of English
    If Language = 2 Then
    ddl_Registration_Semester.DataTextField = "SeasonFrench"
    semesterValues =  dt.AsEnumerable().Select(Function(t) HttpUtility.HtmlEncode(t.Item("SeasonFrench").ToString)).ToList()
    Else
    ddl_Registration_Semester.DataTextField = "SeasonEnglish"
    semesterValues =  dt.AsEnumerable().Select(Function(t) HttpUtility.HtmlEncode(t.Item("SeasonEnglish").ToString)).ToList()
    End If

    End If
    Session("validSemesterValues") = semesterValues

    'ddl_Registration_Semester.DataValueField = "ID"
    ddl_Registration_Semester.DataBind()

    If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then

    Else
    ddl_Registration_Semester.SelectedValue = Session("ddl_Registration_Semester")
    End If
    Catch ex As Exception
    CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex)
    oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity)
    oCICAError.SetValue("EntityLastError", ex.Message)
    oCICAError.SetValue("EntityLastUserError", ex.Message)
    oCICAError.SetValue("ExceptionSource", ex.Source & "-->Registration.ascx.vb-->ddl_Registration_Course_SelectedIndexChanged()")
    oCICAError.SetValue("ExceptionMessage", ex.Message)
    oCICAError.Save()
    End Try
    End Sub
    Protected Sub ddl_Registration_Semester_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddl_Registration_Semester.SelectedIndexChanged
    Try
    Dim sSQL As String = Nothing
    sSQL = ""
    Dim dt As DataTable = Nothing



    ' sSQL = "select Format(vpp.price, 'C', 'en-CA') As Price, vc.Name, vc.ID as CourseId,vc.WebDescription,vAtPP.Applicant,vps.Prefix,vps.FirstName,vps.LastName,UPPER(vAtPP.Curriculum) as Curriculum,vcl.ClassName,vcl.ID as ClassId, vcl.ProductID, CASE WHEN (LEN(ltrim(rtrim(vcl.Place))) = 0) THEN 'Vancouver' ELSE vcl.Place END AS Place, CONVERT(varchar(10), vcl.StartDate, 101) as StartDate, CONVERT(varchar(10), vcl.EndDate, 101) as EndDate from vwAtlanticSchoolProgramProgress__c vAtPP, vwcourses vc, vwClasses vcl, vwproductprices vpp, vwpersons vps where vAtPP.ApplicantID = vps.ID and vc.category = vAtPP.Curriculum and vAtPP.ApplicantID = " & User1.PersonID & " and vpp.MemberTypeID = 5 and vpp.ProductID = vcl.ProductID and convert(nvarchar(10),dateadd(day,+5,vcl.StartDate),126) > convert(nvarchar(10),GETDATE(),126) and vcl.Courseid = vc.id and vc.ID not in (select vcr.CourseID from vwclassregistrations vcr where vcr.status in ('In-Progress','Passed','Pending','Registered') and vcr.studentid = " & User1.PersonID & ") and (vc.ID in (Select courseID from vwCoursePreReqs group by CourseID having count(courseID) = (select count(courseId) from vwclassregistrations  vcr where vcr.status in ('Passed') and vcr.studentid = " & User1.PersonID & ")) OR vc.id not in(select courseID from vwCoursePreReqs )) order By CASE vc.NAME When 'Module 1: Intro Financial Accounting' THEN 1 When 'Module 2: Intro Management Accounting' THEN 2 When 'Module 3: Economics' THEN 3 When 'Module 4: Statistics' THEN 4 When 'Module 5: Financial Accounting' THEN 5 When 'Module 6: Corporate Finance' THEN 6 When 'Module 7: Audit and Assurance' THEN 7 When 'Module 8: Tax' THEN 8 When 'Module 9: Management Accounting' THEN 9 When 'Module 10: Strategy and Governance' THEN 10 When 'Module 11: Business Law' THEN 11 When 'Module 12: IT' THEN 12 End"
    'sSQL = "select Format(vpp.price, 'C', 'en-CA') As Price, vc.Name, vc.ID as CourseId,vc.WebDescription,vAtPP.Applicant,vps.Prefix,vps.FirstName,vps.LastName,UPPER(vAtPP.Curriculum) as Curriculum,vcl.ClassName,vcl.ID as ClassId, vcl.ProductID, CASE WHEN (LEN(ltrim(rtrim(vcl.Place))) = 0) THEN '' ELSE vcl.Place END AS Place, CONVERT(varchar(10), vcl.StartDate, 101) as StartDate, CONVERT(varchar(10), vcl.EndDate, 101) as EndDate from vwAtlanticSchoolProgramProgress__c vAtPP, vwcourses vc, vwClasses vcl, vwproductprices vpp, vwpersons vps where vAtPP.ApplicantID = vps.ID and vc.category = vAtPP.Curriculum and vAtPP.ApplicantID = " & User1.PersonID & " and vpp.MemberTypeID = 5 and vpp.ProductID = vcl.ProductID and convert(nvarchar(10),vcl.registrationclosed,126) > convert(nvarchar(10),GETDATE(),126) and vcl.Courseid = vc.id and vc.ID not in (select vcr.CourseID from vwclassregistrations vcr where vcr.status in ('In-Progress','Passed','Pending','Registered') and vcr.studentid = " & User1.PersonID & ") and (vc.ID in (Select courseID from vwCoursePreReqs group by CourseID having count(courseID) = (select count(courseId) from vwclassregistrations  vcr where vcr.status in ('Passed') and vcr.studentid = " & User1.PersonID & ")) OR vc.id not in(select courseID from vwCoursePreReqs )) order By CASE vc.NAME When 'Module 1: Intro Financial Accounting' THEN 1 When 'Module 2: Intro Management Accounting' THEN 2 When 'Module 3: Economics' THEN 3 When 'Module 4: Statistics' THEN 4 When 'Module 5: Financial Accounting' THEN 5 When 'Module 6: Corporate Finance' THEN 6 When 'Module 7: Audit and Assurance' THEN 7 When 'Module 8: Tax' THEN 8 When 'Module 9: Management Accounting' THEN 9 When 'Module 10: Strategy and Governance' THEN 10 When 'Module 11: Business Law' THEN 11 When 'Module 12: IT' THEN 12 End"

    Dim strProgram As String = Nothing
    Dim strCourse As String = Nothing


    If Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Program") = ddl_Registration_Program.SelectedItem.Value And Session("ddl_Registration_Course") = ddl_Registration_Course.SelectedItem.Value Then
    strProgram = Session("ddl_Registration_Program")
    strCourse = Session("ddl_Registration_Course")
    Else
    strProgram = HttpUtility.HtmlEncode(ddl_Registration_Program.SelectedItem.Value)
    strCourse = HttpUtility.HtmlEncode(ddl_Registration_Course.SelectedItem.Value)
    End If

    'Check validity of selected semester value
    Dim selectedSemester As String = HttpUtility.HtmlEncode(Me.ddl_Registration_Semester.SelectedItem.Text)
    semesterValues = Session("validSemesterValues")

    If semesterValues IsNot Nothing AndAlso semesterValues.Contains(selectedSemester)
    selectedSemester = HttpUtility.HtmlDecode(selectedSemester)
    End If

    Dim programIdParam As Data.IDataParameter = Me.DataAction.GetDataParameter("ProgramID", SqlDbType.BigInt, strProgram)
    Dim courseIdParam As Data.IDataParameter = Me.DataAction.GetDataParameter("CourseID", SqlDbType.BigInt, strCourse)
    Dim seasonParam As Data.IDataParameter = Me.DataAction.GetDataParameter("Season", SqlDbType.NVarChar, selectedSemester )
    If ddl_Registration_Language.SelectedItem.Value = "2" Then 'LanguageID = 2 Then
    'HP July 13th 2016:Registration: English website - french courses. English languae of courses instead of French
    'HP July 13th 2016:Registrations: Grid - Program Name - Display  CurriculumDefinition -> Name instead of Course category
    'Updated By Dharmesh Patel : Replaced Format(vpp.price, 'C', 'en-CA') As Price with '$' + CONVERT(varchar(12), vpp.price, 1) AS Price : Format does not work on Production.
    'Aili 2018-01-25 -- removed one year restiction for the class selction and replaced  vcl.startdate between Getdate() and (Getdate()+365) with and vcl.startdate > Getdate()
    'Aili 2018-02-01 added sorting by start date first and then location
    If Language = 2 Then
    sSQL = "Select distinct 'Français' as ClassLanguage, vcd.ShortNameFrench as cdName, vc.Description as Name, CASE WHEN (LEN(ltrim(rtrim(vcl.Place))) = 0) THEN '' ELSE vcl.Place END AS Place, '$' + CONVERT(varchar(12), vpp.price, 1) AS Price, vcl.StartDate as StartDate_c, CONVERT(varchar(10), vcl.StartDate, 101) as StartDate, CONVERT(varchar(10), vcl.EndDate, 101) as EndDate, CONVERT(varchar(10), vcl.RegistrationClosed, 101) as RegistrationClosed, vc.ID as CourseId, vcl.ClassName, vcl.ID as ClassId, vcl.ProductID from vwcourses vc, vwClasses vcl, vwproductprices vpp, vwCurriculumCourseCat vccc, vwcurriculumDefinitions vcd where vcd.ID = vccc.CurriculumID and vccc.CategoryID = vc.CategoryID and vc.ID = vcl.CourseID and vpp.ProductID = vcl.ProductID and vcl.startdate > Getdate() and vcd.IsFrench = 1 and vcl.ClassLanguage = 'French' and vcd.ID = ProgramID and vc.ID = CourseID and vcl.seasonFrench = Season and (ISNULL(vpp.EndDate,'')='' OR  vpp.EndDate > GETDATE()) order by 6 asc,4"
    Else
    sSQL = "Select distinct vcl.ClassLanguage, vcd.ShortNameEnglish as cdName, vc.Name as Name, CASE WHEN (LEN(ltrim(rtrim(vcl.Place))) = 0) THEN '' ELSE vcl.Place END AS Place, '$' + CONVERT(varchar(12), vpp.price, 1) AS Price, vcl.StartDate as StartDate_c, CONVERT(varchar(10), vcl.StartDate, 101) as StartDate, CONVERT(varchar(10), vcl.EndDate, 101) as EndDate, CONVERT(varchar(10), vcl.RegistrationClosed, 101) as RegistrationClosed, vc.ID as CourseId, vcl.ClassName, vcl.ID as ClassId, vcl.ProductID from vwcourses vc, vwClasses vcl, vwproductprices vpp, vwCurriculumCourseCat vccc, vwcurriculumDefinitions vcd where vcd.ID = vccc.CurriculumID and vccc.CategoryID = vc.CategoryID and vc.ID = vcl.CourseID and vpp.ProductID = vcl.ProductID and vcl.startdate > Getdate() and vcd.IsFrench = 1 and vcl.ClassLanguage = 'French' and vcd.ID =  ProgramID and vc.ID = CourseID and vcl.seasonEnglish =Season and (ISNULL(vpp.EndDate,'')='' OR  vpp.EndDate > GETDATE())  order by 6 asc,4"
    End If

    Else
    'HP July 18th 2016:Registration: French website - English courses. French language of courses instead of English
    If Language = 2 Then
    sSQL = "Select distinct 'Anglais' as ClassLanguage, vcd.ShortNameFrench as cdName, vc.Description as  name, CASE WHEN (LEN(ltrim(rtrim(vcl.Place))) = 0) THEN '' ELSE vcl.Place END AS Place, '$' + CONVERT(varchar(12), vpp.price, 1) AS Price, vcl.StartDate as StartDate_c, CONVERT(varchar(10), vcl.StartDate, 101) as StartDate, CONVERT(varchar(10), vcl.EndDate, 101) as EndDate, CONVERT(varchar(10), vcl.RegistrationClosed, 101) as RegistrationClosed, vc.ID as CourseId, vcl.ClassName, vcl.ID as ClassId, vcl.ProductID from vwcourses vc, vwClasses vcl, vwproductprices vpp, vwCurriculumCourseCat vccc, vwcurriculumDefinitions vcd where vcd.ID = vccc.CurriculumID and vccc.CategoryID = vc.CategoryID and vc.ID = vcl.CourseID  and vpp.ProductID = vcl.ProductID and vcl.startdate > Getdate() and vcd.IsEnglish = 1 and vcl.ClassLanguage = 'English' and vcd.ID =  ProgramID and vc.ID = CourseID and vcl.seasonFrench =Season and (ISNULL(vpp.EndDate,'')='' OR  vpp.EndDate > GETDATE())  order by 6 asc,4"
    Else
    sSQL = "Select distinct vcl.ClassLanguage, vcd.ShortNameEnglish as cdName, vc.Name, CASE WHEN (LEN(ltrim(rtrim(vcl.Place))) = 0) THEN '' ELSE vcl.Place END AS Place, '$' + CONVERT(varchar(12), vpp.price, 1) AS Price, vcl.StartDate as StartDate_c,CONVERT(varchar(10), vcl.StartDate, 101) as StartDate, CONVERT(varchar(10), vcl.EndDate, 101) as EndDate, CONVERT(varchar(10), vcl.RegistrationClosed, 101) as RegistrationClosed, vc.ID as CourseId, vcl.ClassName, vcl.ID as ClassId, vcl.ProductID from vwcourses vc, vwClasses vcl, vwproductprices vpp, vwCurriculumCourseCat vccc, vwcurriculumDefinitions vcd where vcd.ID = vccc.CurriculumID and vccc.CategoryID = vc.CategoryID and vc.ID = vcl.CourseID and vpp.ProductID = vcl.ProductID and vcl.startdate > Getdate() and vcd.IsEnglish = 1 and vcl.ClassLanguage = 'English' and vcd.ID =  ProgramID and vc.ID = CourseID and vcl.seasonEnglish =Season and (ISNULL(vpp.EndDate,'')='' OR  vpp.EndDate > GETDATE())  order by 6 asc,4"
    End If

    End If


    dt = DataAction.GetDataTableParametrized(sSQL, CommandType.Text, {programIdParam, courseIdParam, seasonParam})



    If (dt.Rows.Count.Equals(0)) Then
    lbl_DisplayMyCourses_Error.Visible = True
    'Repeater1.Visible = False
    lblSteps.Visible = False
    grdMyClasses.Visible = False
    btn_Registration_ProceedToSummary.Visible = False
    btn_Registration_Back.Visible = False
    lbl_Registration_SelectMessage.Visible = False
    Else
    'lblHeader.Text = "Welcome : " & dt.Rows(0)("Prefix") & " " & dt.Rows(0)("FirstName") & " " & dt.Rows(0)("LastName") & "

Based on your profile transcript evalution, you are eligible for the " & dt.Rows(0)("Curriculum") & " program." 'lblHeader.Text = "

Based on your transcript evaluation, you are currently eligible to register for " & dt.Rows(0)("Curriculum") & "." grdMyClasses.DataSource = dt grdMyClasses.AllowPaging = False grdMyClasses.DataBind() grdMyClasses.Visible = True lbl_DisplayMyCourses_Error.Visible = False lblSteps.Visible = False btn_Registration_ProceedToSummary.Visible = True lbl_Registration_Message.Visible = True btn_Registration_Back.Visible = True End If Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->Registration.ascx.vb-->ddl_Registration_Semester_SelectedIndexChanged()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End Sub Protected Sub proceedButton_Click(sender As Object, e As EventArgs) Handles btn_Registration_ProceedToSummary.Click Try 'System.Threading.Thread.Sleep(5000) Session("ddl_Registration_Language") = ddl_Registration_Language.SelectedItem.Value Session("ddl_Registration_Program") = ddl_Registration_Program.SelectedItem.Value Session("ddl_Registration_Course") = ddl_Registration_Course.SelectedItem.Value Session("ddl_Registration_Semester") = ddl_Registration_Semester.SelectedItem.Value 'Dim dt As New DataTable If Session("summaryDataTable") Is Nothing Then Session("summaryDataTable") = New DataTable CType(Session("summaryDataTable"), DataTable).Columns.Add("ClassLanguage", GetType(String)) CType(Session("summaryDataTable"), DataTable).Columns.Add("CategoryID_Name", GetType(String)) CType(Session("summaryDataTable"), DataTable).Columns.Add("Name", GetType(String)) CType(Session("summaryDataTable"), DataTable).Columns.Add("Place", GetType(String)) CType(Session("summaryDataTable"), DataTable).Columns.Add("Price", GetType(String)) CType(Session("summaryDataTable"), DataTable).Columns.Add("ID", GetType(Integer)) CType(Session("summaryDataTable"), DataTable).Columns.Add("ProductID", GetType(String)) CType(Session("summaryDataTable"), DataTable).Columns.Add("PriceInt", GetType(Double)) CType(Session("summaryDataTable"), DataTable).Columns.Add(examDateSummaryColumn, GetType(String)) 'Else ' 'dt = CType(Session("summaryDataTable"), DataTable) End If Dim class_id As String = Nothing Dim row_num As Integer = -1 Dim examDate As String = Nothing Dim sessionSummary As DataTable = Nothing For Each row As GridViewRow In grdMyClasses.Rows Dim cell_0_ClassLanguage As String = grdMyClasses.Rows(row.RowIndex).Cells(0).Text Dim cell_1_CategoryID_Name As String = grdMyClasses.Rows(row.RowIndex).Cells(1).Text Dim cell_2_Name As String = grdMyClasses.Rows(row.RowIndex).Cells(2).Text Dim cell_3_Place As String = grdMyClasses.Rows(row.RowIndex).Cells(3).Text Dim cell_4_Price As String = grdMyClasses.Rows(row.RowIndex).Cells(4).Text Dim cell_5_ProductID As String = grdMyClasses.Rows(row.RowIndex).Cells(5).Text Dim lbl_Price As Literal = CType(row.FindControl("priceLable"), Literal) cell_4_Price = lbl_Price.Text Dim cell_6_PriceInt As Double = Double.Parse(Replace(cell_4_Price, "$", "")) Dim lbl_ProductID As Literal = CType(row.FindControl("ProductIDLabel"), Literal) cell_5_ProductID = lbl_ProductID.Text 'Dim chkRow As CheckBox = CType(row.FindControl("chkRow"), CheckBox) Dim chkRow As CheckBox = DirectCast(grdMyClasses.Rows(row.RowIndex).Cells(4).FindControl("chkRow"), CheckBox) 'CheckBox chkRow = (row.Cells[3].FindControl("chkRow") as CheckBox); If chkRow.Checked Then 'dTotalPrice = dTotalPrice + cell_4_Value_price class_id = chkRow.Attributes("value").ToString() 'string class_id = row.Cells[3].Text; 'dt.Rows.Add(class_name, class_id); 'If Session("summaryDataTable") Is Nothing Then ' 'dt.Rows.Add(cell_0_ClassLanguage, cell_1_CategoryID_Name, cell_2_Name, cell_3_Place, cell_4_Price, cell_5_ProductID) ' CType(Session("summaryDataTable"), DataTable).Columns.Add("ClassLanguage", "CategoryID_Name", cell_2_Name, cell_3_Place, cell_4_Price, cell_5_ProductID) 'Else examDate = GetExamDate(grdMyClasses.Rows(row.RowIndex)) sessionSummary = CType(Session("summaryDataTable"), DataTable) sessionSummary.Rows.Add(cell_0_ClassLanguage, cell_1_CategoryID_Name, cell_2_Name, cell_3_Place, cell_4_Price, class_id, cell_5_ProductID, cell_6_PriceInt, examDate) row_num = sessionSummary.Rows.Count-1 'End If End If Next If (ddl_Registration_Program.SelectedItem.Value = "2") Then If class_id IsNot Nothing AndAlso row_num > -1 Session("ddl_Registration_Prep_ClassId") = class_id Session("ddl_Registration_RowNum") = row_num row_num = -1 End If End If 'If dt.Rows.Count > 0 Then ' 'dt.Rows.Add("Grand Total", "$" & dTotalPrice, 0, "", "") ' 'If Session("summaryDataTable") Is Nothing Then ' Session("summaryDataTable") = Nothing ' Session("summaryDataTable") = dt ' 'Else ' 'End If 'End If 'dt = Nothing 'Commented By Dharmesh 'Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) 'Following is added by Dharmesh for CRM Atlantic - Intended CFE Date - Number: IT0004850 - Requested by CRM Casto If (ddl_Registration_Program.SelectedItem.Value = "1") And (ddl_Registration_Course.SelectedItem.Value = "29") Then Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) End If If (ddl_Registration_Program.SelectedItem.Value = "1") And (ddl_Registration_Course.SelectedItem.Value = "48") Then Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) End If If (ddl_Registration_Program.SelectedItem.Value = "1") And (ddl_Registration_Course.SelectedItem.Value = "49") Then Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) End If 'Else ' Response.Redirect("~/Education/RegistrationCFE.aspx", False) 'End If ' 'ElseIf (ddl_Registration_Program.SelectedItem.Value = "2") Then ' ' Response.Redirect("~/Education/RegistrationPrepCourse.aspx", False) ' 'Else ' ' Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) ' 'End If ' End If 'End If 'Programs & Exams Dropdown Selected on Education/Registration.aspx 'English ddl_Registration_Program.SelectedItem.Value selections are (1, 2, 7, 8, 9, 10, 11) 'Language of instruction = English '------------------------------------------------ 'CRM PEP Is ddl_Registration_Program.SelectedItem.Value = 1 'CRM PREP Courses Is ddl_Registration_Program.SelectedItem.Value = 2 'Common Final Examination (CFE) Is ddl_Registration_Program.SelectedItem.Value = 7 'PEP Challenge Exams Is ddl_Registration_Program.SelectedItem.Value = 8 'CRM Preparatory Course Challenge Exams Is ddl_Registration_Program.SelectedItem.Value = 9 'CRM Preparatory Course Re-Write Exams Is ddl_Registration_Program.SelectedItem.Value = 10 'PEP Re - Write() Exams Is ddl_Registration_Program.SelectedItem.Value = 11 'French ddl_Registration_Program.SelectedItem.Value selections are (1, 7, 8, 9, 10, 11) 'Language of instruction = French '------------------------------------------------------ 'CRM PEP Is ddl_Registration_Program.SelectedItem.Value = 1 'Common Final Examination (CFE) Is ddl_Registration_Program.SelectedItem.Value = 7 'PEP Challenge Exams Is ddl_Registration_Program.SelectedItem.Value = 8 'CRM Preparatory Course Challenge Exams Is ddl_Registration_Program.SelectedItem.Value = 9 'CRM Preparatory Course Re-Write Exams Is ddl_Registration_Program.SelectedItem.Value = 10 'PEP Re - Write() Exams Is ddl_Registration_Program.SelectedItem.Value = 11 'MB: Sept 29, 2021: 'MB: Sept 29, 2021: 'If English language is selected If (ddl_Registration_Language.SelectedItem.Value = "1") Then ' Part One Selections (1, 2, 7, 8, 9, 10, 11) 'English ddl_Registration_Program.SelectedItem.Value that are available are (1, 2, 7, 8, 9, 10, 11) ' Therefore all English ddl_Registration_Program.SelectedItem.Values are accounted for If (ddl_Registration_Program.SelectedItem.Value = "1") Then Response.Redirect("~/Education/Workshop.aspx", False) ElseIf (ddl_Registration_Program.SelectedItem.Value = "7") Then Response.Redirect("~/Education/Workshop.aspx", False) ElseIf (ddl_Registration_Program.SelectedItem.Value = "8") Then Response.Redirect("~/Education/Workshop.aspx", False) ElseIf (ddl_Registration_Program.SelectedItem.Value = "11") Then Response.Redirect("~/Education/Workshop.aspx", False) ' Part Two Selections ElseIf (ddl_Registration_Program.SelectedItem.Value = "2") Then Response.Redirect("~/Education/Location.aspx", False) ElseIf (ddl_Registration_Program.SelectedItem.Value = "9") Then Response.Redirect("~/Education/Location.aspx", False) ElseIf (ddl_Registration_Program.SelectedItem.Value = "10") Then Response.Redirect("~/Education/Location.aspx", False) End If End If 'MB: Sept 29, 2021: 'If French language is selected If (ddl_Registration_Language.SelectedItem.Value = "2") Then ' French ddl_Registration_Program.SelectedItem.Value selections that are available are (1, 7, 8, 9, 10, 11) ' CRM has asked 4 of these selections be routed to the new 'FrenchLocation page' 'Therefore all French ddl_Registration_Program.SelectedItem.Values are accounted for ' Part Three French Selections If (ddl_Registration_Program.SelectedItem.Value = "1") Then Response.Redirect("~/Education/FrenchLocation.aspx", False) ElseIf (ddl_Registration_Program.SelectedItem.Value = "7") Then Response.Redirect("~/Education/FrenchLocation.aspx", False) ElseIf (ddl_Registration_Program.SelectedItem.Value = "8") Then Response.Redirect("~/Education/FrenchLocation.aspx", False) ElseIf (ddl_Registration_Program.SelectedItem.Value = "11") Then Response.Redirect("~/Education/FrenchLocation.aspx", False) 'The remaining 2 French ddl_Registration_Program.SelectedItem.Values are routed to ~/Education/SummarySelectedCourses.aspx ElseIf (ddl_Registration_Program.SelectedItem.Value = "9") Then Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) ElseIf (ddl_Registration_Program.SelectedItem.Value = "10") Then Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) End If End If Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->Registration.ascx.vb-->proceedButton_Click()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End Sub 'Public Function IPToInteger(ByVal Expression As String) As Integer ' Try ' Dim strValue As String = Expression ' With IPAddress ' Return (System.Convert.ToInt32(.GetAddressBytes(3)) << 24) Or (System.Convert.ToInt32(.GetAddressBytes(2)) << 16) Or (System.Convert.ToInt32(.GetAddressBytes(1)) << 8) Or System.Convert.ToInt32(.GetAddressBytes(0)) ' End With ' Catch ex As Exception ' Return 0I ' End Try 'End Function Protected Sub DO_NOT_USE(sender As Object, e As EventArgs) Try Session("summaryDataTable") = Nothing Dim dt As New DataTable dt.Columns.Add("Name", GetType(String)) dt.Columns.Add("Price", GetType(String)) dt.Columns.Add("ID", GetType(Integer)) dt.Columns.Add("ProductID", GetType(String)) dt.Columns.Add("Place", GetType(String)) Dim dTotalPrice As Decimal = 0 For Each row As GridViewRow In grdMyClasses.Rows Dim cell_0_Value As String = grdMyClasses.Rows(row.RowIndex).Cells(0).Text Dim cell_1_Value As String = grdMyClasses.Rows(row.RowIndex).Cells(1).Text Dim cell_2_Value_class As String = grdMyClasses.Rows(row.RowIndex).Cells(2).Text Dim cell_5_Value_place As String = grdMyClasses.Rows(row.RowIndex).Cells(5).Text Dim cell_4_Value_price As String = grdMyClasses.Rows(row.RowIndex).Cells(4).Text Dim cell_7_Value_ProductID As String = grdMyClasses.Rows(row.RowIndex).Cells(7).Text Dim lbl_price As Literal = CType(row.FindControl("priceLable"), Literal) cell_4_Value_price = lbl_price.Text Dim lbl_ProductID As Literal = CType(row.FindControl("ProductIDLabel"), Literal) cell_7_Value_ProductID = lbl_ProductID.Text 'Dim chkRow As CheckBox = CType(row.FindControl("chkRow"), CheckBox) Dim chkRow As CheckBox = DirectCast(grdMyClasses.Rows(row.RowIndex).Cells(4).FindControl("chkRow"), CheckBox) 'CheckBox chkRow = (row.Cells[3].FindControl("chkRow") as CheckBox); If chkRow.Checked Then dTotalPrice = dTotalPrice + cell_4_Value_price Dim class_id As String = chkRow.Attributes("value").ToString() 'string class_id = row.Cells[3].Text; 'dt.Rows.Add(class_name, class_id); dt.Rows.Add(cell_2_Value_class, cell_4_Value_price, class_id, cell_7_Value_ProductID, cell_5_Value_place) End If Next If dt.Rows.Count > 0 Then dt.Rows.Add("Grand Total", "$" & dTotalPrice, 0, "", "") Session("summaryDataTable") = dt End If dt = Nothing Response.Redirect("SummarySelectedCourses.aspx", False) Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->Registration.ascx.vb-->DO_NOT_USE()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End Sub Protected Sub backButton_Click(sender As Object, e As EventArgs) Handles btn_Registration_Back.Click Response.Redirect("Declarations.aspx", False) 'Response.Redirect("~/CustomerService/Profile.aspx", False) 'Response.Redirect(Page.Request.ApplicationPath) End Sub Protected Sub cmdLogOut_Click(sender As Object, e As EventArgs) Handles cmdLogOut.Click Dim bLoggedOut As Boolean = False Try If WebUserLogin1.Logout() Then 'Suraj Issue 15370,7/31/13 revert back changes application variale to session variable Session.Remove("ReturnToPage") WebUserLogin1.ClearAutoLoginCookie(Page.Response) 'HP Issue#9078: clear and delete session Session.Clear() Session.Abandon() bLoggedOut = True 'RashmiP, Call Clear Cookies function ClearCookies() Session("SocialNetwork") = Nothing End If Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->Registration.ascx.vb-->cmdLogOut_Click()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try If bLoggedOut Then OnUserLoggedOut() End If End Sub Private Sub ClearCookies() Dim i As Integer Dim aCookie As HttpCookie Dim limit As Integer = Request.Cookies.Count - 1 For i = 0 To limit aCookie = Request.Cookies(i) aCookie.Expires = DateTime.Now.AddDays(-1) Response.Cookies.Add(aCookie) Next End Sub Protected Overridable Sub OnUserLoggedOut() If Not Session Is Nothing Then Session("UserLoggedIn") = False End If 'Response.Redirect(HomePage) Response.Redirect("~/login.aspx") End Sub Protected Sub grdMyClasses_RowDataBound(sender As Object, e As GridViewRowEventArgs) End Sub Private Function GetExamDate(ByRef row As GridViewRow) As String Dim examDate As String = Nothing '7= Common Final Examination (CFE)|9= CRM Preparatory Course Challenge Exam|10= CRM Preparatory Course Re-Write Exam Dim startDateProgramGroup() As String = {"7","9","10"} '1= CRM Professional Education Program (CRM PEP)|8= CRM PEP Challenge Exam|11= CRM PEP Re-Write Exam Dim endDateProgramGroup() As String = {"1","8","11"} '17= Capstone 1|18= Capstone 2 Dim noDateCourseGroup() As String = {"17", "18"} If startDateProgramGroup.Contains(ddl_Registration_Program.SelectedItem.Value) Then 'examDate = row.Cells(4).Text 'IT0129291 -Logic Error Self-Serve Portal; Exam Dates for Re-Writes/Challenge Exams 'mb: Feb 11, 2022 CRM Casto noticed that "Exam Dates" are Not being correctly reflected on the 'SummaryOfSelectedCourses Page for courses under the following two programs: CRM Preparatory Course Challenge Exams / CRM Preparatory Course Re-Write Exams examDate = row.Cells(5).Text ElseIf endDateProgramGroup.Contains(ddl_Registration_Program.SelectedItem.Value) Then If ddl_Registration_Program.SelectedItem.Value = "1" AndAlso noDateCourseGroup.Contains(ddl_Registration_Course.SelectedItem.Value) examDate = "N/A" Else examDate = row.Cells(5).Text End If Else examDate = "N/A" End If Return examDate End Function End Class End Namespace ============================================ Imports System.Data Imports System.Globalization Imports System.Web.SessionState Imports CRM.Framework.BusinessLogic.GenericEntity Namespace CRM.Framework.Web.eBusiness Partial Class RegistrationPrepCourse Inherits CRM.Framework.Web.eBusiness.BaseUserControlAdvanced Dim oCICAError As CRMGenericEntity Private m_Language As Integer Public js_Registartion_CheckBoxAlert As String Public Property Language As Integer Get Return m_Language End Get Set(ByVal value As Integer) m_Language = value End Set End Property Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Session("rbl_Declarations_DeclarConsent") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarRegulations") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarDocumentation") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAccept") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarOrganization") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAmin") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarShared") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAnnualFee") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarEvaluation") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarExam") IsNot Nothing AndAlso Session("rbl_Declarations_AttestCriminalOffence") IsNot Nothing AndAlso Session("rbl_Declarations_AttestInvestigation") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSuspension") IsNot Nothing AndAlso Session("rbl_Declarations_AttestBankrupt") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSecurity") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSociety") IsNot Nothing AndAlso Session("rbl_Declarations_AttestCertify") IsNot Nothing Then Else Response.Redirect("~/CustomerService/Profile.aspx", False) End If Me.Language = 1 If Not Session("Language") Is Nothing Then Me.Language = CInt(Session("Language")) Else Dim hfLanguage As HiddenField = DirectCast(Me.Page.Master.FindControl("hfLanguage"), HiddenField) If Not hfLanguage Is Nothing Then If Not hfLanguage.Value Is Nothing Then Me.Language = CInt(hfLanguage.Value) End If End If End If If Not IsPostBack Then Try 'lblError.Visible = False btn_Registration_Back.Visible = True btn_Registration_ProceedToSummary.Visible = True If Language = 2 Then 'Tab titles HP Me.pcTopicMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_ContactInfo Me.pcSubscriptionMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Declarations Me.pcEventMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Registration lbl_Registration_Title.Text = Resources.CRMAtlanticFrench.lbl_Registration_Title.ToString lbl_DisplayPrep_Text.Text = Resources.CRMAtlanticFrench.lbl_DisplayPrep_Text.ToString() lbl_RegistrationPrep_Intended_Date.Text = Resources.CRMAtlanticFrench.lbl_RegistrationPrep_Intended_Date.ToString() ddl_RegistrationPrep_Intended_Date.Items.Insert(0, New ListItem(Resources.CRMAtlanticFrench.ddl_RegistrationCFE_Intended_Date.ToString(), "0")) btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticFrench.btn_Registration_ProceedToSummary.ToString() btn_Registration_Back.Text = Resources.CRMAtlanticFrench.btn_Registration_Back.ToString() Else lbl_Registration_Title.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Title.ToString lbl_DisplayPrep_Text.Text = Resources.CRMAtlanticEnglish.lbl_DisplayPrep_Text.ToString() lbl_RegistrationPrep_Intended_Date.Text = Resources.CRMAtlanticEnglish.lbl_RegistrationPrep_Intended_Date.ToString() ddl_RegistrationPrep_Intended_Date.Items.Insert(0, New ListItem(Resources.CRMAtlanticEnglish.ddl_RegistrationCFE_Intended_Date.ToString(), "0")) btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticEnglish.btn_Registration_ProceedToSummary.ToString() btn_Registration_Back.Text = Resources.CRMAtlanticEnglish.btn_Registration_Back.ToString() End If Dim sSQL As String = Nothing Dim dt As DataTable = Nothing Dim classId As String = Nothing ddl_RegistrationPrep_Intended_Date.AppendDataBoundItems = True If Session("ddl_Registration_Prep_ClassId") Is Nothing Then classId = "-1" Else classId = HttpUtility.HtmlEncode(Session("ddl_Registration_Prep_ClassId").ToString()) End If sSQL = Database & "..spCRMGetExamDates" Dim classIdParam As Data.IDataParameter = Me.DataAction.GetDataParameter("ClassId", SqlDbType.BigInt, classId) dt = DataAction.GetDataTableParametrized(sSQL, CommandType.StoredProcedure, {classIdParam}) dt.Columns.Add("FormattedDate", GetType(String)) If Language = 2 Then For x As Integer = 0 To (dt.Rows.Count - 1) dt.Rows(x)("FormattedDate") = String.Format("{0} ({1} {2})", CType(dt.Rows(x)("ExamDate").ToString(), Date).ToString("d MMMM yyyy", System.Globalization.CultureInfo.GetCultureInfo("fr-FR")), Resources.CRMAtlanticFrench.str_RegistrationPrep_Semester, dt.Rows(x)("Semester")) Next Else For x As Integer = 0 To (dt.Rows.Count - 1) dt.Rows(x)("FormattedDate") = String.Format("{0} ({1} {2})", CType(dt.Rows(x)("ExamDate").ToString(), Date).ToString("MMMM d, yyyy"), Resources.CRMAtlanticEnglish.str_RegistrationPrep_Semester, dt.Rows(x)("Semester")) Next End If ddl_RegistrationPrep_Intended_Date.DataSource = dt If Language = 2 Then ddl_RegistrationPrep_Intended_Date.DataTextField = "FormattedDate" Else ddl_RegistrationPrep_Intended_Date.DataTextField = "FormattedDate" End If ddl_RegistrationPrep_Intended_Date.DataValueField = "ExamDate" ddl_RegistrationPrep_Intended_Date.DataBind() Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->RegistrationPrepCourse.ascx.vb-->Page_Load()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try Else Session("ddl_Registration_Language") = Nothing Session("ddl_Registration_Program") = Nothing Session("ddl_Registration_Course") = Nothing Session("ddl_Registration_Semester") = Nothing End If End Sub Protected Sub proceedButton_Click(sender As Object, e As EventArgs) Try Page.Validate() If Not Page.IsValid Then Exit Sub End If Dim examDate As Date = Nothing Dim selectedExamDate = HttpUtility.HtmlEncode(ddl_RegistrationPrep_Intended_Date.SelectedItem.Value.ToString()) If selectedExamDate IsNot Nothing And Date.TryParse(selectedExamDate, examDate) Then Dim dt As New DataTable dt = CType(Session("summaryDataTable"), DataTable) If Not dt.Columns.Contains("PrepExamDate") Then dt.Columns.Add("PrepExamDate", GetType(Date)) End If 'MB: Feb 14, 2021 - this updates the0 current row index 'based on the Location the user selects. It then updates 'CType(Session("summaryDataTable"), DataTable) If dt IsNot Nothing Then Dim row As DataRow = dt.Rows(CInt(HttpUtility.HtmlEncode(Session("ddl_Registration_RowNum").ToString()))) If row IsNot Nothing Then row("PrepExamDate") = examDate row("ExamDate") = examDate.ToString("MM/dd/yyyy") 'MB: Feb 11, 2021 If Session("Location_PageA") IsNot Nothing Then row("Place") = Session("Location_PageA").ToString End If If Session("Location_PageB") IsNot Nothing Then row("Place") = Session("Location_PageB").ToString End If If Session("Location_PageC") IsNot Nothing Then row("Place") = Session("Location_PageC").ToString End If 'MB: Oct 20, 2021 - added session to get Registration_Prep_Course_Exam_Date_Chosen and populate it in SummaryOfSelectedCourses Page Session("Registration_Prep_Course_Exam_Date_Chosen") = examDate.ToString("MM/dd/yyyy") End If End If Session("summaryDataTable") = dt Session("ddl_Registration_Prep_ClassId") = Nothing Session("ddl_Registration_RowNum") = Nothing Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) Else RemoveSelectedPrepCourse() End If Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->RegistrationPrepCourse.ascx.vb-->proceedButton_Click()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() RemoveSelectedPrepCourse() End Try End Sub Protected Sub backButton_Click(sender As Object, e As EventArgs) Handles btn_Registration_Back.Click RemoveSelectedPrepCourse() Response.Redirect("Registration.aspx", False) End Sub Private Sub RemoveSelectedPrepCourse() Try Dim dt As New DataTable dt = CType(Session("summaryDataTable"), DataTable) If dt IsNot Nothing Then Dim row As DataRow = dt.Rows(CInt(HttpUtility.HtmlEncode(Session("ddl_Registration_RowNum").ToString()))) If row IsNot Nothing Then row.Delete() End If End If Session("summaryDataTable") = dt Session("ddl_Registration_Prep_ClassId") = Nothing Session("ddl_Registration_RowNum") = Nothing Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->RegistrationPrepCourse.ascx.vb-->backButton_Click()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End Sub End Class End Namespace ================================ <% Control Language="VB" AutoEventWireup="false" CodeFile="SummarySelectedCourses.ascx.vb" Inherits="CRM.Framework.Web.eBusiness.Education.SummarySelectedCourses" %> <% Register TagPrefix="cc1" Namespace="CRM.Framework.Web.eBusiness" Assembly="CRMEBusinessUser" %> <% Register TagPrefix="cc4" Namespace="CRM.Framework.Web.eBusiness" Assembly="EBusinessShoppingCart" %> <% Register TagPrefix="cc3" Namespace="CRM.Framework.Web.eBusiness" Assembly="EBusinessLogin" %>

<%-- --%>

<%--

--%>

==================================================== Imports System.Data Imports CRM.Framework.BusinessLogic.GenericEntity Imports System.Globalization Imports System.Drawing Namespace CRM.Framework.Web.eBusiness.Education Partial Class SummarySelectedCourses Inherits eBusiness.BaseUserControlAdvanced Dim oCICAError As CRMGenericEntity Dim m_Oapp As CRM.Framework.Application.CRMApplication Dim m_oda As CRM.Framework.DataServices.ICRMDataAction Protected Const ATTRIBUTE_CONFIRMATION_PAGE As String = "OrderConfirmationPage" Protected Const ATTRIBUTE_CONTORL_DEFAULT_NAME As String = "SummarySelectedCourses" Private m_Language As Integer Public deletebutton_text As LinkButton Public js_SummarySelectedCourses_RemoveAlert As String Private Const prepExamDtColName As String = "PrepExamDate" Public Overridable Property OrderConfirmationPage() As String Get If Not ViewState(ATTRIBUTE_CONFIRMATION_PAGE) Is Nothing Then Return CStr(ViewState(ATTRIBUTE_CONFIRMATION_PAGE)) Else Return String.Empty End If End Get Set(ByVal value As String) ViewState(ATTRIBUTE_CONFIRMATION_PAGE) = Me.FixLinkForVirtualPath(value) End Set End Property Public Property Language As Integer Get Return m_Language End Get Set(ByVal value As Integer) m_Language = value End Set End Property Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Session("rbl_Declarations_DeclarConsent") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarRegulations") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarDocumentation") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAccept") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarOrganization") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAmin") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarShared") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAnnualFee") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarEvaluation") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarExam") IsNot Nothing AndAlso Session("rbl_Declarations_AttestCriminalOffence") IsNot Nothing AndAlso Session("rbl_Declarations_AttestInvestigation") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSuspension") IsNot Nothing AndAlso Session("rbl_Declarations_AttestBankrupt") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSecurity") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSociety") IsNot Nothing AndAlso Session("rbl_Declarations_AttestCertify") IsNot Nothing Then Else Response.Redirect("~/CustomerService/Profile.aspx", False) End If SetProperties() Me.Language = 1 If Not Session("Language") Is Nothing Then Me.Language = CInt(Session("Language")) Else Dim hfLanguage As HiddenField = DirectCast(Me.Page.Master.FindControl("hfLanguage"), HiddenField) If Not hfLanguage Is Nothing Then If Not hfLanguage.Value Is Nothing Then If hfLanguage.Value <> "" Then Me.Language = CInt(hfLanguage.Value) End If End If End If End If If Not IsPostBack Then Try If Language = 2 Then 'Tab titles HP Me.pcTopicMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_ContactInfo Me.pcSubscriptionMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Declarations Me.pcEventMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Registration lbl_ContactInfo_Title.Text = Resources.CRMAtlanticFrench.lbl_ContactInfo_Title lbl_SummarySelectedCourses_Description.Text = Resources.CRMAtlanticFrench.lbl_OrderSummary_Description.ToString() lnk_SummarySelectedCourses_AddAnotherCourse.Text = Resources.CRMAtlanticFrench.lnk_SummarySelectedCourses_AddAnotherCourse.ToString() btn_SummarySelectedCourses_Checkout.Text = Resources.CRMAtlanticFrench.lnk_SummarySelectedCourses_Checkout.ToString() btn_SummarySelectedCourses_Back.Text = Resources.CRMAtlanticFrench.btn_SummarySelectedCourses_Back.ToString() lbl_SummarySelectedCourses_Title.Text = Resources.CRMAtlanticFrench.lbl_SummarySelectedCourses_Title.ToString 'Grid GridView1.Columns("0").HeaderText = Resources.CRMAtlanticFrench.gd_SummarySelectedCourses_Header_Language GridView1.Columns("1").HeaderText = Resources.CRMAtlanticFrench.gd_SummarySelectedCourses_Header_Program GridView1.Columns("2").HeaderText = Resources.CRMAtlanticFrench.gd_SummarySelectedCourses_Header_Course GridView1.Columns("3").HeaderText = Resources.CRMAtlanticFrench.gd_SummarySelectedCourses_Header_ExamDate GridView1.Columns("4").HeaderText = Resources.CRMAtlanticFrench.gd_SummarySelectedCourses_Header_Location GridView1.Columns("5").HeaderText = Resources.CRMAtlanticFrench.gd_SummarySelectedCourses_Header_Price GridView1.Columns("6").HeaderText = Resources.CRMAtlanticFrench.gd_SummarySelectedCourses_Header_Remove 'Error lbl_SummarySelectedCourses_Error.Text = "" & Resources.CRMAtlanticFrench.lbl_SummarySelectedCourses_Error.ToString() & "" Dim lbl_Loading_Wait_Msg As Label lbl_Loading_Wait_Msg = DirectCast(updateProcessingIndicator.Controls(0).FindControl("lblLoading"), Label) lbl_Loading_Wait_Msg.Text = Resources.CRMAtlanticFrench.lblLoading js_SummarySelectedCourses_RemoveAlert = Resources.CRMAtlanticFrench.js_SummarySelectedCourses_RemoveAlert Else lbl_ContactInfo_Title.Text = Resources.CRMAtlanticEnglish.lbl_ContactInfo_Title lbl_SummarySelectedCourses_Description.Text = Resources.CRMAtlanticEnglish.lbl_OrderSummary_Description.ToString() lnk_SummarySelectedCourses_AddAnotherCourse.Text = Resources.CRMAtlanticEnglish.lnk_SummarySelectedCourses_AddAnotherCourse.ToString() btn_SummarySelectedCourses_Checkout.Text = Resources.CRMAtlanticEnglish.lnk_SummarySelectedCourses_Checkout.ToString() btn_SummarySelectedCourses_Back.Text = Resources.CRMAtlanticEnglish.btn_SummarySelectedCourses_Back.ToString() lbl_SummarySelectedCourses_Title.Text = Resources.CRMAtlanticEnglish.lbl_SummarySelectedCourses_Title.ToString 'Grid GridView1.Columns("0").HeaderText = Resources.CRMAtlanticEnglish.gd_SummarySelectedCourses_Header_Language GridView1.Columns("1").HeaderText = Resources.CRMAtlanticEnglish.gd_SummarySelectedCourses_Header_Program GridView1.Columns("2").HeaderText = Resources.CRMAtlanticEnglish.gd_SummarySelectedCourses_Header_Course GridView1.Columns("3").HeaderText = Resources.CRMAtlanticEnglish.gd_SummarySelectedCourses_Header_ExamDate GridView1.Columns("4").HeaderText = Resources.CRMAtlanticEnglish.gd_SummarySelectedCourses_Header_Location GridView1.Columns("5").HeaderText = Resources.CRMAtlanticEnglish.gd_SummarySelectedCourses_Header_Price GridView1.Columns("6").HeaderText = Resources.CRMAtlanticEnglish.gd_SummarySelectedCourses_Header_Remove 'Error lbl_SummarySelectedCourses_Error.Text = & Resources.CRMAtlanticEnglish.lbl_SummarySelectedCourses_Error.ToString() & "" Dim lbl_Loading_Wait_Msg As Label lbl_Loading_Wait_Msg = DirectCast(updateProcessingIndicator.Controls(0).FindControl("lblLoading"), Label) lbl_Loading_Wait_Msg.Text = Resources.CRMAtlanticEnglish.lblLoading js_SummarySelectedCourses_RemoveAlert = Resources.CRMAtlanticEnglish.js_SummarySelectedCourses_RemoveAlert End If If Not Session("summaryDataTable") Is Nothing Then Dim dt As New DataTable dt = CType(Session("summaryDataTable"), DataTable) dt = delete_Total_Tax_BalanceOwning(dt) dt = populate_Total_Tax_BalanceOwning(dt) 'Dim Place_Tax() As DataRow 'If Language = 2 Then ' Place_Tax = dt.Select("Place = '" & Resources.CRMAtlanticFrench.gd_OrderConfirmation_Tax.ToString() & "'") 'Else ' Place_Tax = dt.Select("Place = '" & Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Tax.ToString() & "'") 'End If 'For Each row As DataRow In Place_Tax ' row.Delete() 'Next 'Dim Place_Total() As DataRow 'If Language = 2 Then ' Place_Total = dt.Select("Place = '" & Resources.CRMAtlanticFrench.gd_OrderConfirmation_Total.ToString() & "'") 'Else ' Place_Total = dt.Select("Place = '" & Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Total.ToString() & "'") 'End If 'For Each row As DataRow In Place_Total ' row.Delete() 'Next 'Dim Place_Balance_owning() As DataRow 'If Language = 2 Then ' Place_Balance_owning = dt.Select("Place = '" & Resources.CRMAtlanticFrench.gd_OrderConfirmation_Balance.ToString() & "'") 'Else ' Place_Balance_owning = dt.Select("Place = '" & Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Balance.ToString() & "'") 'End If 'For Each row As DataRow In Place_Balance_owning ' row.Delete() 'Next ''Fetch tax from CRM 'Dim sSQL As String = String.Empty 'sSQL = "SELECT Rate FROM ..vwSalesTaxRates where Active = 1" 'Dim staxRate As Decimal = Convert.ToString(Me.DataAction.ExecuteScalar(sSQL, DataServices.ICRMDataAction.DSLCacheSetting.BypassCache)) ''dt = CType(Session("summaryDataTable"), DataTable) 'Dim sum As Double = Convert.ToDouble(dt.Compute("SUM(PriceInt)", String.Empty)) 'Dim total As Double = sum * (staxRate / 100) 'Dim balance_owing As Double = sum + total 'Dim dr As DataRow 'dr = dt.NewRow() 'dr("ClassLanguage") = "" 'dr("CategoryID_Name") = "" 'dr("Name") = "" 'dr("Place") = IIf(Language = 2, Resources.CRMAtlanticFrench.gd_OrderConfirmation_Total.ToString(), Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Total.ToString()) 'dr("Price") = sum.ToString("C", CultureInfo.CreateSpecificCulture("en-CA")) 'dt.Rows.Add(dr) 'Dim dr1 As DataRow 'dr1 = dt.NewRow() 'dr1("ClassLanguage") = "" 'dr1("CategoryID_Name") = "" 'dr1("Name") = "" 'dr1("Place") = IIf(Language = 2, Resources.CRMAtlanticFrench.gd_OrderConfirmation_Tax.ToString(), Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Tax.ToString()) 'dr1("Price") = total.ToString("C", CultureInfo.CreateSpecificCulture("en-CA")) 'dt.Rows.Add(dr1) 'Dim dr2 As DataRow 'dr2 = dt.NewRow() 'dr2("ClassLanguage") = "" 'dr2("CategoryID_Name") = "" 'dr2("Name") = "" 'dr2("Place") = IIf(Language = 2, Resources.CRMAtlanticFrench.gd_OrderConfirmation_Balance.ToString(), Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Balance.ToString()) 'dr2("Price") = balance_owing.ToString("C", CultureInfo.CreateSpecificCulture("en-CA")) 'dt.Rows.Add(dr2) 'dt.AcceptChanges() GridView1.AllowPaging = False GridView1.DataSource = dt GridView1.DataBind() btn_SummarySelectedCourses_Back.Visible = True btn_SummarySelectedCourses_Checkout.Visible = True 'btn_SummarySelectedCourses_Plastiq.Visible = True 'cancelButton.Visible = True End If Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->SummarySelectedCourses.ascx.vb-->Page_Load()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End If End Sub Protected Overrides Sub SetProperties() Try If String.IsNullOrEmpty(Me.ID) Then Me.ID = ATTRIBUTE_CONTORL_DEFAULT_NAME 'call base method to set parent properties MyBase.SetProperties() If String.IsNullOrEmpty(OrderConfirmationPage) Then OrderConfirmationPage = Me.GetLinkValueFromXML(ATTRIBUTE_CONFIRMATION_PAGE) End If Catch ex As Exception End Try End Sub Protected Sub backButton_Click(sender As Object, e As EventArgs) Handles btn_SummarySelectedCourses_Back.Click Try 'Session("summaryDataTable") = Nothing 'commented by Dharmesh 'Response.Redirect("~/Education/Registration.aspx", False) If ((Session("ddl_Registration_Program") = "1") AndAlso (Session("ddl_Registration_Course") = "29" Or Session("ddl_Registration_Course") = "48" Or Session("ddl_Registration_Course") = "49")) Then Response.Redirect("~/Education/RegistrationCFE.aspx", False) Else Response.Redirect("~/Education/Registration.aspx", False) End If Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->SummarySelectedCourses.ascx.vb-->backButton_Click()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End Sub 'Protected Sub cancelButton_Click(sender As Object, e As EventArgs) Handles cancelButton.Click ' 'Session("summaryDataTable") = Nothing ' Response.Redirect("~/Education/DisplayMyCourses.aspx", False) 'End Sub 'Protected Sub okButton_Click(sender As Object, e As EventArgs) Handles okButton.Click Protected Sub NotUse(sender As Object, e As EventArgs) Dim dt As New DataTable dt = CType(Session("summaryDataTable"), DataTable) GridView1.AllowPaging = False GridView1.DataSource = dt GridView1.DataBind() End Sub Protected Sub cmdLogOut_Click(sender As Object, e As EventArgs) Handles cmdLogOut.Click Dim bLoggedOut As Boolean = False Try If WebUserLogin1.Logout() Then 'Suraj Issue 15370,7/31/13 revert back changes application variale to session variable Session.Remove("ReturnToPage") WebUserLogin1.ClearAutoLoginCookie(Page.Response) 'HP Issue#9078: clear and delete session Session.Clear() Session.Abandon() bLoggedOut = True 'RashmiP, Call Clear Cookies function ClearCookies() Session("SocialNetwork") = Nothing End If Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->SummarySelectedCourses.ascx.vb-->cmdLogOut_Click()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try If bLoggedOut Then OnUserLoggedOut() End If End Sub Private Sub ClearCookies() Dim i As Integer Dim aCookie As HttpCookie Dim limit As Integer = Request.Cookies.Count - 1 For i = 0 To limit aCookie = Request.Cookies(i) aCookie.Expires = DateTime.Now.AddDays(-1) Response.Cookies.Add(aCookie) Next End Sub Protected Overridable Sub OnUserLoggedOut() If Not Session Is Nothing Then Session("UserLoggedIn") = False End If 'Response.Redirect(HomePage) Response.Redirect("~/login.aspx") End Sub Protected Sub lnk_SummarySelectedCourses_AddAnotherCouse_Click(sender As Object, e As EventArgs) Try Session("ddl_Registration_Language") = Nothing Session("ddl_Registration_Program") = Nothing Session("ddl_Registration_Course") = Nothing Session("ddl_Registration_Semester") = Nothing 'MB: Feb 11, 2021 Session("Location_PageA") = Nothing Session("Location_PageB") = Nothing Session("Location_PageC") = Nothing Session("Workshop_PageA") = Nothing Session("Workshop_PageB") = Nothing Session("Workshop_PageC") = Nothing Session("Workshop_PageD") = Nothing Session("French_Location_PageA") = Nothing Session("French_Location_PageB") = Nothing Session("French_Location_PageC") = Nothing Session("French_Location_PageD") = Nothing Response.Redirect("Registration.aspx", False) Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->SummarySelectedCourses.ascx.vb-->lnk_SummarySelectedCourses_AddAnotherCouse_Click()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End Sub Private Function populate_Total_Tax_BalanceOwning(dt As DataTable) As DataTable Try 'Fetch tax from CRM Dim params(0) As IDataParameter params(0) = Me.DataAction.GetDataParameter("PersonID", SqlDbType.BigInt, User1.PersonID) Dim staxRate As Decimal = 0 'Check the Preferred BillToCountry for this user. If anything other than Canada then do not calculate the taxes Dim intBillToCountryCodeID As Integer = 36 Dim ssQLBillToCountry As String = String.Empty ssQLBillToCountry = "Select isnull(case when PreferredBillingAddress ='Home Address' then HomeCountryCodeID else CountryCodeID end,36) as BillToCountryID from vwPersons where ID = PersonID" Dim dtBillToCountry As DataTable = DataAction.GetDataTableParametrized(ssQLBillToCountry, CommandType.Text, params) If Not dtBillToCountry Is Nothing Then If dtBillToCountry.Rows.Count > 0 Then intBillToCountryCodeID = dtBillToCountry.Rows(0)(0) End If End If If intBillToCountryCodeID = 36 Then 'BillToCountry is Canada therefore calculate the taxes Dim sSQL As String = String.Empty sSQL = "SELECT Rate FROM ..vwSalesTaxRates where Active = 1" staxRate = Convert.ToString(Me.DataAction.ExecuteScalar(sSQL, DataServices.ICRMDataAction.DSLCacheSetting.BypassCache)) End If 'dt = CType(Session("summaryDataTable"), DataTable) If (dt.Rows.Count > 0) Then Dim sum As Double = Convert.ToDouble(dt.Compute("SUM(PriceInt)", String.Empty)) Dim total As Double = sum * (staxRate / 100) Dim balance_owing As Double = sum + total Dim dr As DataRow dr = dt.NewRow() dr("ClassLanguage") = "" dr("CategoryID_Name") = "" dr("Name") = "" dr("Place") = IIf(Language = 2, Resources.CRMAtlanticFrench.gd_OrderConfirmation_Total.ToString(), Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Total.ToString()) dr("Price") = sum.ToString("C", CultureInfo.CreateSpecificCulture("en-CA")) dt.Rows.Add(dr) Dim dr1 As DataRow dr1 = dt.NewRow() dr1("ClassLanguage") = "" dr1("CategoryID_Name") = "" dr1("Name") = "" dr1("Place") = IIf(Language = 2, Resources.CRMAtlanticFrench.gd_OrderConfirmation_Tax.ToString(), Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Tax.ToString()) dr1("Price") = total.ToString("C", CultureInfo.CreateSpecificCulture("en-CA")) dt.Rows.Add(dr1) Dim dr2 As DataRow dr2 = dt.NewRow() dr2("ClassLanguage") = "" dr2("CategoryID_Name") = "" dr2("Name") = "" dr2("Place") = IIf(Language = 2, Resources.CRMAtlanticFrench.gd_OrderConfirmation_Balance.ToString(), Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Balance.ToString()) dr2("Price") = balance_owing.ToString("C", CultureInfo.CreateSpecificCulture("en-CA")) dt.Rows.Add(dr2) btn_SummarySelectedCourses_Back.Visible = True btn_SummarySelectedCourses_Checkout.Visible = True 'btn_SummarySelectedCourses_Plastiq.Visible = True Else btn_SummarySelectedCourses_Back.Visible = True btn_SummarySelectedCourses_Checkout.Visible = False 'btn_SummarySelectedCourses_Plastiq.Visible = False End If Return dt Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->SummarySelectedCourses.ascx.vb-->populate_Total_Tax_BalanceOwning") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End Function Private Function delete_Total_Tax_BalanceOwning(dt As DataTable) As DataTable 'Added Dim Place_Tax() As DataRow If Language = 2 Then Place_Tax = dt.Select("Place = '" & Resources.CRMAtlanticFrench.gd_OrderConfirmation_Tax.ToString() & "'") Else Place_Tax = dt.Select("Place = '" & Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Tax.ToString() & "'") End If For Each row As DataRow In Place_Tax row.Delete() Next Dim Place_Total() As DataRow If Language = 2 Then Place_Total = dt.Select("Place = '" & Resources.CRMAtlanticFrench.gd_OrderConfirmation_Total.ToString() & "'") Else Place_Total = dt.Select("Place = '" & Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Total.ToString() & "'") End If For Each row As DataRow In Place_Total row.Delete() Next Dim Place_Balance_owning() As DataRow If Language = 2 Then Place_Balance_owning = dt.Select("Place = '" & Resources.CRMAtlanticFrench.gd_OrderConfirmation_Balance.ToString() & "'") Else Place_Balance_owning = dt.Select("Place = '" & Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Balance.ToString() & "'") End If For Each row As DataRow In Place_Balance_owning row.Delete() Next dt.AcceptChanges() Return dt End Function Protected Sub GridView1_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Try Dim index As Int32 = Convert.ToInt32(e.RowIndex) Dim dt As New DataTable dt = CType(Session("summaryDataTable"), DataTable) dt.Rows.RemoveAt(e.RowIndex) dt = delete_Total_Tax_BalanceOwning(dt) dt = populate_Total_Tax_BalanceOwning(dt) Me.GridView1.DataSource = dt GridView1.DataBind() Session("summaryDataTable") = dt 'MB: Oct 12, 2021: the SummarySelectedCourses page is refreshed to complete the delete event Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->SummarySelectedCourses.ascx.vb-->GridView1_RowDeleting()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End Sub Protected Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then Dim LinkButton1 As LinkButton = TryCast(e.Row.FindControl("DeleteButton"), LinkButton) LinkButton1.Text = IIf(Language = 2, Resources.CRMAtlanticFrench.DeleteButton.ToString(), Resources.CRMAtlanticEnglish.DeleteButton.ToString()) If e.Row.Cells(4).Text = IIf(Language = 2, Resources.CRMAtlanticFrench.gd_OrderConfirmation_Total.ToString(), Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Total.ToString()) Or e.Row.Cells(4).Text = IIf(Language = 2, Resources.CRMAtlanticFrench.gd_OrderConfirmation_Tax.ToString(), Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Tax.ToString()) Or e.Row.Cells(4).Text = IIf(Language = 2, Resources.CRMAtlanticFrench.gd_OrderConfirmation_Balance.ToString(), Resources.CRMAtlanticEnglish.gd_OrderConfirmation_Balance.ToString()) Then LinkButton1.Visible = False e.Row.Cells(4).ForeColor = Color.White e.Row.Cells(5).ForeColor = Color.White e.Row.Cells(4).BackColor = System.Drawing.ColorTranslator.FromHtml("#006fba") e.Row.Cells(5).BackColor = System.Drawing.ColorTranslator.FromHtml("#006fba") Else End If End If End Sub Protected Sub Do_Not_Required_btn_SummarySelectedCourses_Checkout_Click(sender As Object, e As EventArgs) Response.Redirect("~/Education/OrderSummary.aspx", False) End Sub Protected Sub btn_SummarySelectedCourses_Checkout_Click(sender As Object, e As EventArgs) Dim sError As String = "" 'System.Threading.Thread.Sleep(5000) Try If Session("rbl_Declarations_DeclarConsent") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarRegulations") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarDocumentation") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAccept") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarOrganization") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAmin") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarShared") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAnnualFee") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarEvaluation") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarExam") IsNot Nothing AndAlso Session("rbl_Declarations_AttestCriminalOffence") IsNot Nothing AndAlso Session("rbl_Declarations_AttestInvestigation") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSuspension") IsNot Nothing AndAlso Session("rbl_Declarations_AttestBankrupt") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSecurity") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSociety") IsNot Nothing AndAlso Session("rbl_Declarations_AttestCertify") IsNot Nothing Then Dim oOrder As CRM.Applications.OrderEntry.OrdersEntity 'Dim oOrder As CRMGenericEntityBase Dim dt2 As New DataTable Dim dt3 As New DataTable Dim PersonID As Long PersonID = User1.PersonID 'Dim sSQL As String = "select * from CRM.dbo.vwpersons where id = " + User1.PersonID 'dt2 = DataAction.GetDataTable(sSQL, DataServices.ICRMDataAction.DSLCacheSetting.BypassCache) Dim newOrder As Long = -1 'Using Shooping Cart Control oOrder = ShoppingCart1.GetOrderObject(Session, Page.User, Application) 'Using normal 'oOrder = CRMApplication.GetEntityObject("Orders", -1) 'oOrder.SetValue("BillToID", dt2.Rows(0).Item("ID")) 'oOrder.SetValue("ShipToID", dt2.Rows(0).Item("ID")) 'Select Case dt2.Rows(0).Item("PreferredBillingAddress").ToString.Trim ' Case "Business Address" ' oOrder.SetValue("BillToAddressID", dt2.Rows(0).Item("AddressID")) 'Need to check Preferred Billing Address and set this from that. ' oOrder.SetValue("ShipToAddressID", dt2.Rows(0).Item("AddressID")) 'Need to check Preferred Billing Address and set this from that. ' Case "Home Address" ' oOrder.SetValue("ShipToAddressID", dt2.Rows(0).Item("HomeAddressID")) 'Need to check Preferred Billing Address and set this from that. ' oOrder.SetValue("BillToAddressID", dt2.Rows(0).Item("HomeAddressID")) 'Need to check Preferred Billing Address and set this from that. ' Case "Billing Address" ' oOrder.SetValue("BillToAddressID", dt2.Rows(0).Item("BillingAddressID")) 'Need to check Preferred Billing Address and set this from that. ' oOrder.SetValue("ShipToAddressID", dt2.Rows(0).Item("BillingAddressID")) 'Need to check Preferred Billing Address and set this from that. 'End Select 'oOrder.SetValue("EmployeeID", m_Oapp.UserCredentials.GetUserRelatedRecordID("Employees")) oOrder.SetValue("OrganizationID", 5) oOrder.SetValue("InitialPaymentAmount", 0) oOrder.SetValue("OrderSourceID", 4) oOrder.SetValue("OrderLevelID", 1) 'Following is required if you order normal way (not using Shooping Cart Control) 'oOrder.SetValue("BillToID", User1.PersonID) 'oOrder.SetValue("ShipToID", User1.PersonID) 'oOrder.SetValue("PayTypeID", 4) 'oOrder.SetValue("OrderTypeID", 1) 'oOrder.SetValue("OrderStatusID", 1) 'We have delete_Total_Tax_BalanceOwning dt3 = delete_Total_Tax_BalanceOwning(CType(Session("summaryDataTable"), DataTable)) 'Remove the row that stored Totals information - H.P. 'dt3.Rows.RemoveAt(dt3.Rows.Count - 1) 'HP july 18th. Status changed from Non Approved to Not Approved 'Dim sStatus As String = "Non Approved" Dim sStatus As String = "Not Approved" 'Dim sStatus As String = CStr(CRMApplication.Entity("Class Registrations").EntityMetaData.Fields("Status").DefaultValue) Dim lOrderID As Long Dim prepExamColExists As Boolean = dt3.Columns.Contains(prepExamDtColName) For Each row As DataRow In dt3.Rows With oOrder.AddProduct(CLng(row("ProductID"))).Item(0) .SetValue("Description", row("Name").ToString & " - " & CStr(User1.LastName) & ", " & CStr(User1.FirstName)) '.SetValue("Description", row("Name").ToString & " - " & Session("LastName") & ", " & CStr(Session("FirstName"))) If Not IsNothing(.ExtendedOrderDetailEntity) Then .ExtendedOrderDetailEntity.SetValue("ClassID", row("ID")) .ExtendedOrderDetailEntity.SetValue("StudentID", User1.PersonID) '.ExtendedOrderDetailEntity.SetValue("StudentID", Session("PersonID")) .ExtendedOrderDetailEntity.SetValue("Status", sStatus) .ExtendedOrderDetailEntity.SetValue("DateAvailable", Now) 'MB: Feb 14, 2021 - this updates Exam Date and Location based 'on the Location the user selects .ExtendedOrderDetailEntity.SetValue("ExamDate", row("ExamDate")) .ExtendedOrderDetailEntity.SetValue("Location", row("Place")) 'If prepExamColExists AndAlso Not IsDBNull(row(prepExamDtColName)) Then ' .ExtendedOrderDetailEntity.SetValue("ExamDate", CDate(row(prepExamDtColName))) 'End If 'HP: save object data which will be used by the shoppingCart.PlaceOrder() to load the extended Order Detail separately .SetAddValue("__ExtendedAttributeObjectData", .ExtendedOrderDetailEntity.GetObjectData(False)) End If End With Next 'Following is required if you order using Shooping Cart Control) With ShoppingCart1.GetOrderObject(Session, Page.User, Application) .SetValue("PayTypeID", 1) .SetValue("OrderTypeID", 1) .SetValue("OrderStatusID", 1) ShoppingCart1.SaveCart(Session) lOrderID = ShoppingCart1.PlaceOrder(Session, Application, Page.User, sError) End With 'Following is required if you order normal way (not using Shooping Cart Control) 'oOrder.Save(False) 'lOrderID = oOrder.GetValue("ID") If lOrderID > 0 Then 'Following Try block is added by Dharmesh for CRM Atlantic - Intended CFE Date - Number: IT0004850 - Requested by CRM Casto Try 'Save Common Final Examination (CFE) write dates If Session("ddl_RegistrationCFE_Intended_Date") IsNot Nothing Then Dim oPersonGE As CRMGenericEntityBase = Nothing oPersonGE = CRMApplication.GetEntityObject("Persons", User1.PersonID) oPersonGE.SetValue("IntendedCFEDate", Session("ddl_RegistrationCFE_Intended_Date").ToString) oPersonGE.Save() End If Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) End Try 'Save Declarations Dim oDeclarations As CRMGenericEntityBase Try 'HP - Check if a record exists in Declarations: Dim params(0) As IDataParameter Dim intDeclarationsID As Integer = -1 params(0) = Me.DataAction.GetDataParameter("UserID", SqlDbType.BigInt, User1.PersonID) Dim dtDeclarations As DataTable = DataAction.GetDataTableParametrized("Select TOp 1 ID from vwdeclarations where PersonID = UserID order by ID DESC", CommandType.Text, params) If Not dtDeclarations Is Nothing Then If dtDeclarations.Rows.Count > 0 Then intDeclarationsID = dtDeclarations.Rows(0)("ID") End If End If 'oDeclarations = CRMApplication.GetEntityObject("Declarations", -1) oDeclarations = CRMApplication.GetEntityObject("Declarations", intDeclarationsID) oDeclarations.SetValue("PersonID", User1.PersonID) oDeclarations.SetValue("DeclarConsent", Session("rbl_Declarations_DeclarConsent").ToString) oDeclarations.SetValue("DeclarRegulations", Session("rbl_Declarations_DeclarRegulations").ToString) oDeclarations.SetValue("DeclarDocumentation", Session("rbl_Declarations_DeclarDocumentation").ToString) oDeclarations.SetValue("DeclarAccept", Session("rbl_Declarations_DeclarAccept").ToString) oDeclarations.SetValue("DeclarOrganization", Session("rbl_Declarations_DeclarOrganization").ToString) oDeclarations.SetValue("DeclarAdmin", Session("rbl_Declarations_DeclarAmin").ToString) oDeclarations.SetValue("DeclarShared", Session("rbl_Declarations_DeclarShared").ToString) oDeclarations.SetValue("DeclarAnnualFee", Session("rbl_Declarations_DeclarAnnualFee").ToString) oDeclarations.SetValue("DeclarEvaluation", Session("rbl_Declarations_DeclarEvaluation").ToString) oDeclarations.SetValue("DeclarExam", Session("rbl_Declarations_DeclarExam").ToString) oDeclarations.SetValue("AttestCriminalOffence", Session("rbl_Declarations_AttestCriminalOffence").ToString) oDeclarations.SetValue("AttestInvestigation", Session("rbl_Declarations_AttestInvestigation").ToString) oDeclarations.SetValue("AttestSuspension", Session("rbl_Declarations_AttestSuspension").ToString) oDeclarations.SetValue("AttestBankrupt", Session("rbl_Declarations_AttestBankrupt").ToString) oDeclarations.SetValue("AttestSecurity", Session("rbl_Declarations_AttestSecurity").ToString) oDeclarations.SetValue("AttestSociety", Session("rbl_Declarations_AttestSociety").ToString) oDeclarations.SetValue("AttestCertify", Session("rbl_Declarations_AttestCertify").ToString) If oDeclarations.Save(False) Then Else Dim oCICAError As CRMGenericEntity 'CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("RecordID", User1.PersonID) oCICAError.SetValue("EntityID", 1797) oCICAError.SetValue("EntityName", "Declarations") oCICAError.SetValue("EntityLastError", oDeclarations.LastError) oCICAError.SetValue("EntityLastUserError", oDeclarations.LastUserError) oCICAError.SetValue("ExceptionSource", "SummarySelectedCourses.ascx.vb -> btn_SummarySelectedCourses_Checkout_Click() -> While Saving Declarations - oDeclarations") oCICAError.SetValue("ExceptionMessage", "Error in saving Declarations") oCICAError.Save() End If Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) End Try 'Response.Redirect(OrderConfirmationPage & "?ID=" & lOrderID, False) Response.Redirect("~/CustomerService/OrderConfirmation.aspx?ID=" & lOrderID, False) Else 'If Language = 2 Then ' lbl_SummarySelectedCourses_Error.Text = & Resources.CRMAtlanticFrench.lbl_SummarySelectedCourses_Error.ToString() & "" ' lbl_SummarySelectedCourses_Error.Visible = True 'Else ' 'lbl_SummarySelectedCourses_Error.Text = "An issue occured while creating an order. Please contact the Members'/Customer Services department of CRM Atlantic School at toll free at 1-800-268-3793 for further assistance.
" & sError ' lbl_SummarySelectedCourses_Error.Text = & Resources.CRMAtlanticEnglish.lbl_SummarySelectedCourses_Error.ToString() & "" ' lbl_SummarySelectedCourses_Error.Visible = True 'End If lbl_SummarySelectedCourses_Error.Visible = True End If Else 'If Language = 2 Then ' lbl_SummarySelectedCourses_Error.Text = & Resources.CRMAtlanticFrench.lbl_SummarySelectedCourses_Error.ToString() & "" ' lbl_SummarySelectedCourses_Error.Visible = True 'Else ' 'lbl_SummarySelectedCourses_Error.Text = "Your Session is expired." ' lbl_SummarySelectedCourses_Error.Text = & Resources.CRMAtlanticEnglish.lbl_SummarySelectedCourses_Error.ToString() & "" ' lbl_SummarySelectedCourses_Error.Visible = True 'End If lbl_SummarySelectedCourses_Error.Visible = True End If 'Seesion If ends Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) 'If Language = 2 Then ' lbl_SummarySelectedCourses_Error.Text = & Resources.CRMAtlanticFrench.lbl_SummarySelectedCourses_Error.ToString() & "" ' lbl_SummarySelectedCourses_Error.Visible = True 'Else ' 'lbl_SummarySelectedCourses_Error.Text = "An issue occured while creating an order. Please contact the Members'/Customer Services department of CRM Atlantic School at toll free at 1-800-268-3793 for further assistance.
" & sError ' lbl_SummarySelectedCourses_Error.Text = & Resources.CRMAtlanticEnglish.lbl_SummarySelectedCourses_Error.ToString() & "" ' lbl_SummarySelectedCourses_Error.Visible = True 'End If lbl_SummarySelectedCourses_Error.Visible = True CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->SummarySelectedCourses.ascx.vb-->btn_SummarySelectedCourses_Checkout_Click()") oCICAError.SetValue("ExceptionMessage", ex.Message & sError) oCICAError.Save() End Try End Sub End Class End Namespace =================================== Imports System.Data Imports System.Web.SessionState Imports CRM.Framework.BusinessLogic.GenericEntity Namespace CRM.Framework.Web.eBusiness Partial Class Workshop Inherits CRM.Framework.Web.eBusiness.BaseUserControlAdvanced Dim oCICAError As CRMGenericEntity Private m_Language As Integer Public js_Registartion_CheckBoxAlert As String 'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: added string to store the session variable from the Programs & Exams dropdown in the Education/Registration.aspx page Public Current_Workshop_Page_Session As String Public Current_Registration_Program_Session As String Public Property Language As Integer Get Return m_Language End Get Set(ByVal value As Integer) m_Language = value End Set End Property Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load 'MB: Oct 12, 2021: added session variable to obtain the value selected from the Programs & Exams dropdown in the Registration page. 'This variable used as a condition to send the Workshop session variable to the SummarySelectedCourses page. Current_Workshop_Page_Session = Session("ddl_Registration_Program") Current_Registration_Program_Session = Session("ddl_Registration_Program") If Session("rbl_Declarations_DeclarConsent") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarRegulations") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarDocumentation") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAccept") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarOrganization") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAmin") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarShared") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarAnnualFee") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarEvaluation") IsNot Nothing AndAlso Session("rbl_Declarations_DeclarExam") IsNot Nothing AndAlso Session("rbl_Declarations_AttestCriminalOffence") IsNot Nothing AndAlso Session("rbl_Declarations_AttestInvestigation") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSuspension") IsNot Nothing AndAlso Session("rbl_Declarations_AttestBankrupt") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSecurity") IsNot Nothing AndAlso Session("rbl_Declarations_AttestSociety") IsNot Nothing AndAlso Session("rbl_Declarations_AttestCertify") IsNot Nothing Then Else Response.Redirect("~/CustomerService/Profile.aspx", False) End If Me.Language = 1 If Not Session("Language") Is Nothing Then Me.Language = CInt(Session("Language")) Else Dim hfLanguage As HiddenField = DirectCast(Me.Page.Master.FindControl("hfLanguage"), HiddenField) If Not hfLanguage Is Nothing Then If Not hfLanguage.Value Is Nothing Then Me.Language = CInt(hfLanguage.Value) End If End If End If If Not IsPostBack Then Try 'lblError.Visible = False btn_Registration_Back.Visible = True btn_Registration_ProceedToSummary.Visible = True If Language = 2 Then 'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: added new global variables to update English text 'Tab titles HP Me.pcTopicMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_ContactInfo Me.pcSubscriptionMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Declarations Me.pcEventMiniNavigationTitle.Text = Resources.CRMAtlanticFrench.lbl_MasterPageTab_Registration lbl_Registration_Title.Text = Resources.CRMAtlanticFrench.lbl_Registration_Title.ToString() lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Text.ToString() lbl_WorkshopPage_Location.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Name_Text.ToString() ddl_WorkshopPage_Location.Items.Insert(0, New ListItem(Resources.CRMAtlanticFrench.lbl_FrenchLocation_Select_Text.ToString(), "0")) btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticFrench.btn_Registration_ProceedToSummary.ToString() btn_Registration_Back.Text = Resources.CRMAtlanticFrench.btn_Registration_Back.ToString() 'MB: Oct 26, 2021 - added condition for when "CRM PREP" is selected for "Anglais" If Language = 2 And Current_Registration_Program_Session.ToString() = "1" Then lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Text.ToString() End If If Language = 2 And Current_Registration_Program_Session.ToString() = "7" Then lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Text.ToString() End If If Language = 2 And Current_Registration_Program_Session.ToString() = "8" Then lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Text.ToString() End If If Language = 2 And Current_Registration_Program_Session.ToString() = "11" Then lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticFrench.lbl_FrenchLocation_Text.ToString() End If Else lbl_Registration_Title.Text = Resources.CRMAtlanticEnglish.lbl_Registration_Title.ToString() lbl_DisplayCFE_Text.Text = Resources.CRMAtlanticEnglish.lbl_Workshop_Text.ToString() lbl_WorkshopPage_Location.Text = Resources.CRMAtlanticEnglish.lbl_Location_Select_Text.ToString() ddl_WorkshopPage_Location.Items.Insert(0, New ListItem(Resources.CRMAtlanticEnglish.lbl_Location_Select_Prompt_Dropdown_Text.ToString(), "0")) btn_Registration_ProceedToSummary.Text = Resources.CRMAtlanticEnglish.btn_Registration_ProceedToSummary.ToString() btn_Registration_Back.Text = Resources.CRMAtlanticEnglish.btn_Registration_Back.ToString() End If Dim sSQL As String = Nothing Dim dt As DataTable = Nothing Dim strProgram As String = Nothing ddl_WorkshopPage_Location.AppendDataBoundItems = True If Session("ddl_Registration_Language") Is Nothing And Session("ddl_Registration_Program") Is Nothing And Session("ddl_Registration_Course") Is Nothing And Session("ddl_Registration_Semester") Is Nothing Then strProgram = "2" Else strProgram = HttpUtility.HtmlEncode(Session("ddl_Registration_Program").ToString.Trim) End If 'MB: Oct 22, 2021 'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: updated so dropdowns work based on language selected If Language = 1 Then sSQL = "Select [ID], [Value] as LocationEN FROM vwentityfieldvalues WHERE EntityID = 1534 And EntityFieldsID = 18001" End If If Language = 2 Then sSQL = "Select [ID], [Value] as LocationFR FROM vwentityfieldvalues WHERE EntityID = 1534 And EntityFieldsID = 18001" End If dt = Nothing dt = DataAction.GetDataTable(sSQL, CRM.Framework.DataServices.ICRMDataAction.DSLCacheSetting.BypassCache) ddl_WorkshopPage_Location.DataSource = dt If Language = 2 Then ddl_WorkshopPage_Location.DataTextField = "LocationFR" Else ddl_WorkshopPage_Location.DataTextField = "LocationEN" End If ddl_WorkshopPage_Location.DataValueField = "ID" ddl_WorkshopPage_Location.DataBind() Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->RegistrationCFE.ascx.vb-->Page_Load()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try Else Session("ddl_Registration_Language") = Nothing Session("ddl_Registration_Program") = Nothing Session("ddl_Registration_Course") = Nothing Session("ddl_Registration_Semester") = Nothing End If End Sub Protected Sub proceedButton_Click(sender As Object, e As EventArgs) Try 'Instruct any validation controls included on the page to validate their assigned information. 'Then verify whether the validation succeeded or not. 'Exit the sub if validation fails. Page.Validate() If Not Page.IsValid Then Exit Sub End If 'Dim oPersonGE As CRMGenericEntityBase = Nothing 'oPersonGE = CRMApplication.GetEntityObject("Persons", User1.PersonID) 'oPersonGE.SetValue("IntendedCFEDate", ddl_RegistrationCFE_Intended_Date.SelectedItem.Text.ToString()) 'oPersonGE.Save() 'MB: Oct 12, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: once the OnClick "Proceed" button is selected, 'Current_Workshop_Page_Session checks to see what ' Programs & Exams choice was selected from the dropdown on the Education/Registration.aspx page. ' The dropdown selected item from this page is then inserted into to another session, namely Session("Workshop_PageA"), ' Session("Workshop_PageB"), or Session("Workshop_PageC"). This value is sent to the SummarySelectedCourses Page. If Current_Workshop_Page_Session = "1" Then Session("Workshop_PageA") = ddl_WorkshopPage_Location.SelectedItem.Text.ToString() End If If Current_Workshop_Page_Session = "11" Then Session("Workshop_PageB") = ddl_WorkshopPage_Location.SelectedItem.Text.ToString() End If If Current_Workshop_Page_Session = "8" Then Session("Workshop_PageC") = ddl_WorkshopPage_Location.SelectedItem.Text.ToString() End If If Current_Workshop_Page_Session = "7" Then Session("Workshop_PageD") = ddl_WorkshopPage_Location.SelectedItem.Text.ToString() End If 'MB: Feb 14, 2021 - this updates the0 current row index 'based on the Location the user selects. It then updates 'CType(Session("summaryDataTable"), DataTable) Dim dt As New DataTable dt = CType(Session("summaryDataTable"), DataTable) If (dt.Rows.Count > 0) Then Dim x As Integer = 0 Dim y As Integer For i As Integer = 0 To dt.Rows.Count - 1 Dim row = dt.Rows(i) y = i Next If Session("Workshop_PageA") IsNot Nothing Then dt.Rows(Math.Max(x, y))("Place") = Session("Workshop_PageA").ToString End If If Session("Workshop_PageB") IsNot Nothing Then dt.Rows(Math.Max(x, y))("Place") = Session("Workshop_PageB").ToString End If If Session("Workshop_PageC") IsNot Nothing Then dt.Rows(Math.Max(x, y))("Place") = Session("Workshop_PageC").ToString End If If Session("Workshop_PageD") IsNot Nothing Then dt.Rows(Math.Max(x, y))("Place") = Session("Workshop_PageD").ToString End If End If 'MB: Oct 20, 2021 - feature/exam-workshop-locations-self-serve-IT0126732: 'redirects to Education/RegistrationCFE.aspx if category PREP is selected If Current_Registration_Program_Session = "1" Or Current_Registration_Program_Session = "11" Or Current_Registration_Program_Session = "8" Or Current_Registration_Program_Session = "7" Then Session("Current_Workshop_Page_Session_Chosen") = Current_Workshop_Page_Session Response.Redirect("~/Education/RegistrationCFE.aspx", False) Else Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) End If 'Response.Redirect("~/Education/SummarySelectedCourses.aspx", False) Catch ex As Exception CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) Global.CRM.Framework.ExceptionManagement.ExceptionManager.Publish(ex) oCICAError = TryCast(CRMApplication.GetEntityObject("CICAErrorLog", -1), CRMGenericEntity) oCICAError.SetValue("EntityLastError", ex.Message) oCICAError.SetValue("EntityLastUserError", ex.Message) oCICAError.SetValue("ExceptionSource", ex.Source & "-->RegistrationCFE.ascx.vb-->proceedButton_Click()") oCICAError.SetValue("ExceptionMessage", ex.Message) oCICAError.Save() End Try End Sub Protected Sub backButton_Click(sender As Object, e As EventArgs) Handles btn_Registration_Back.Click Response.Redirect("Registration.aspx", False) 'Response.Redirect("~/CustomerService/Profile.aspx", False) 'Response.Redirect(Page.Request.ApplicationPath) End Sub End Class End Namespace