' This file implements the TableControl, TableControlRow, and RecordControl classes for the ' ShowPersonalEducationTable.aspx page. The Row or RecordControl classes are the ' ideal place to add code customizations. For example, you can override the LoadData, ' CreateWhereClause, DataBind, SaveData, GetUIData, and Validate methods. #Region "Imports statements" Option Strict On Imports Microsoft.VisualBasic Imports BaseClasses.Web.UI.WebControls Imports System Imports System.Collections Imports System.Collections.Generic Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports BaseClasses Imports BaseClasses.Data Imports BaseClasses.Utils Imports ReportTools.ReportCreator Imports ReportTools.Shared Imports Persons.Business Imports Persons.Data #End Region Namespace Persons.UI.Controls.ShowPersonalEducationTable #Region "Section 1: Place your customizations here." Public Class PersonalEducationTableControlRow Inherits BasePersonalEducationTableControlRow ' The BasePersonalEducationTableControlRow implements code for a ROW within the ' the PersonalEducationTableControl table. The BasePersonalEducationTableControlRow implements the DataBind and SaveData methods. ' The loading of data is actually performed by the LoadData method in the base class of PersonalEducationTableControl. ' This is the ideal place to add your code customizations. For example, you can override the DataBind, ' SaveData, GetUIData, and Validate methods. Private Sub PersonalEducationTableControlRow_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender Me.PersonalId.Text = Ps.GetName(Me.DataSource.PersonalId) End Sub End Class Public Class PersonalEducationTableControl Inherits BasePersonalEducationTableControl Protected Overrides Sub PopulateCOUNTRYFilter(ByVal selectedValue As String, ByVal maxItems As Integer) 'Setup the WHERE clause. Dim wc As WhereClause = Me.CreateWhereClause_COUNTRYFilter() Dim orderBy As OrderBy = New OrderBy(False, True) orderBy.Add(CountryTable.CountryId, OrderByItem.OrderDir.Asc) Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") Me.COUNTRYFilter.Items.Clear() Dim itemValue As CountryRecord For Each itemValue In CountryTable.GetRecords(wc, orderBy, 0, maxItems) ' Create the item and add to the list. Dim cvalue As String = Nothing Dim fvalue As String = noValueFormat If itemValue.CountryIdSpecified Then cvalue = itemValue.CountryId.ToString() fvalue = itemValue.Format(CountryTable.Country) End If Dim item As ListItem = New ListItem(fvalue, cvalue) If Me.COUNTRYFilter.Items.IndexOf(item) < 0 Then Me.COUNTRYFilter.Items.Add(item) End If Next ' Add the All item. Me.COUNTRYFilter.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) ' Set the selected value. SetSelectedValue(Me.COUNTRYFilter, selectedValue) End Sub End Class #End Region #Region "Section 2: Do not modify this section." ' Base class for the PersonalEducationTableControlRow control on the ShowPersonalEducationTable page. ' Do not modify this class. Instead override any method in PersonalEducationTableControlRow. Public Class BasePersonalEducationTableControlRow Inherits Persons.UI.BaseApplicationRecordControl ' To customize, override this method in PersonalEducationTableControlRow. Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init Me.ClearControlsFromSession() End Sub ' To customize, override this method in PersonalEducationTableControlRow. Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Call LoadFocusScripts from repeater so that onfocus attribute could be added to elements Me.Page.LoadFocusScripts(Me) ' Show confirmation message on Click Me.PersonalEducationRowDeleteButton.Attributes.Add("onClick", "return (confirm('" & (CType(Me.Page,BaseApplicationPage)).GetResourceValue("DeleteRecordConfirm", "Persons") & "'));") ' Register the event handlers. AddHandler Me.PersonalEducationRowCopyButton.Click, AddressOf PersonalEducationRowCopyButton_Click AddHandler Me.PersonalEducationRowDeleteButton.Click, AddressOf PersonalEducationRowDeleteButton_Click AddHandler Me.PersonalEducationRowEditButton.Click, AddressOf PersonalEducationRowEditButton_Click AddHandler Me.PersonalEducationRowViewButton.Click, AddressOf PersonalEducationRowViewButton_Click AddHandler Me.PersonalId.Click, AddressOf PersonalId_Click End Sub Public Overridable Sub LoadData() ' Load the data from the database into the DataSource PersonalEducation record. ' It is better to make changes to functions called by LoadData such as ' CreateWhereClause, rather than making changes here. ' The RecordUniqueId is set the first time a record is loaded, and is ' used during a PostBack to load the record. If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) Return End If ' Since this is a row in the table, the data for this row is loaded by the ' LoadData method of the BasePersonalEducationTableControl when the data for the entire ' table is loaded. Me.DataSource = New PersonalEducationRecord() End Sub ' Populate the UI controls using the DataSource. To customize, override this method in PersonalEducationTableControlRow. Public Overrides Sub DataBind() ' The DataBind method binds the user interface controls to the values ' from the database record. To do this, it calls the Set methods for ' each of the field displayed on the webpage. It is better to make ' changes in the Set methods, rather than making changes here. MyBase.DataBind() ' Make sure that the DataSource is initialized. If Me.DataSource Is Nothing Then Return End If 'LoadData for DataSource for chart and report if they exist ' Call the Set methods for each controls on the panel SetCommand() SetCommandDate() SetCOUNTRY() SetCourse() SetCourseAbbr() SetCourseNo() SetEducationPeriod() SetEducationType() SetEdYear() SetEndDate() SetFacultry() SetInstitue() SetLevelId() SetNoAll() SetPersonalId() SetScore() SetScoreNo() SetStartDate() Me.IsNewRecord = True If Me.DataSource.IsCreated Then Me.IsNewRecord = False Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString() End If ' Now load data for each record and table child UI controls. ' Ordering is important because child controls get ' their parent ids from their parent UI controls. Dim shouldResetControl As Boolean = False End Sub Public Overridable Sub SetCommand() ' Set the Command Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.Command is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetCommand() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then ' If the Command is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.Command.Text = formattedValue Else ' Command is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue) End If ' If the Command is NULL or blank, then use the value specified ' on Properties. If Me.Command.Text Is Nothing _ OrElse Me.Command.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.Command.Text = " " End If End Sub Public Overridable Sub SetCommandDate() ' Set the CommandDate Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.CommandDate is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetCommandDate() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then ' If the CommandDate is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy") formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.CommandDate.Text = formattedValue Else ' CommandDate is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy") End If ' If the CommandDate is NULL or blank, then use the value specified ' on Properties. If Me.CommandDate.Text Is Nothing _ OrElse Me.CommandDate.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.CommandDate.Text = " " End If End Sub Public Overridable Sub SetCOUNTRY() ' Set the COUNTRY Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.COUNTRY is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetCOUNTRY() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then ' If the COUNTRY is non-NULL, then format the value. ' The Format method will return the Display Foreign Key As (DFKA) value Dim formattedValue As String = "" Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.COUNTRY.ToString(),PersonalEducationTable.COUNTRY, Nothing) if (formattedValue Is Nothing) Then formattedValue = Me.DataSource.Format(PersonalEducationTable.COUNTRY) End If Else formattedValue = Me.DataSource.COUNTRY.ToString() End If formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.COUNTRY.Text = formattedValue Else ' COUNTRY is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.COUNTRY.Text = PersonalEducationTable.COUNTRY.Format(PersonalEducationTable.COUNTRY.DefaultValue) End If ' If the COUNTRY is NULL or blank, then use the value specified ' on Properties. If Me.COUNTRY.Text Is Nothing _ OrElse Me.COUNTRY.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.COUNTRY.Text = " " End If End Sub Public Overridable Sub SetCourse() ' Set the Course Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.Course is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetCourse() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then ' If the Course is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.Course.Text = formattedValue Else ' Course is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue) End If ' If the Course is NULL or blank, then use the value specified ' on Properties. If Me.Course.Text Is Nothing _ OrElse Me.Course.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.Course.Text = " " End If End Sub Public Overridable Sub SetCourseAbbr() ' Set the CourseAbbr Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.CourseAbbr is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetCourseAbbr() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then ' If the CourseAbbr is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.CourseAbbr.Text = formattedValue Else ' CourseAbbr is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue) End If ' If the CourseAbbr is NULL or blank, then use the value specified ' on Properties. If Me.CourseAbbr.Text Is Nothing _ OrElse Me.CourseAbbr.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.CourseAbbr.Text = " " End If End Sub Public Overridable Sub SetCourseNo() ' Set the CourseNo Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.CourseNo is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetCourseNo() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then ' If the CourseNo is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.CourseNo.Text = formattedValue Else ' CourseNo is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue) End If ' If the CourseNo is NULL or blank, then use the value specified ' on Properties. If Me.CourseNo.Text Is Nothing _ OrElse Me.CourseNo.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.CourseNo.Text = " " End If End Sub Public Overridable Sub SetEducationPeriod() ' Set the EducationPeriod Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.EducationPeriod is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetEducationPeriod() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then ' If the EducationPeriod is non-NULL, then format the value. ' The Format method will return the Display Foreign Key As (DFKA) value Dim formattedValue As String = "" Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.EducationPeriod.ToString(),PersonalEducationTable.EducationPeriod, Nothing) if (formattedValue Is Nothing) Then formattedValue = Me.DataSource.Format(PersonalEducationTable.EducationPeriod) End If Else formattedValue = Me.DataSource.EducationPeriod.ToString() End If formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.EducationPeriod.Text = formattedValue Else ' EducationPeriod is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.EducationPeriod.Text = PersonalEducationTable.EducationPeriod.Format(PersonalEducationTable.EducationPeriod.DefaultValue) End If ' If the EducationPeriod is NULL or blank, then use the value specified ' on Properties. If Me.EducationPeriod.Text Is Nothing _ OrElse Me.EducationPeriod.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.EducationPeriod.Text = " " End If End Sub Public Overridable Sub SetEducationType() ' Set the EducationType Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.EducationType is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetEducationType() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then ' If the EducationType is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EducationType) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.EducationType.Text = formattedValue Else ' EducationType is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.EducationType.Text = PersonalEducationTable.EducationType.Format(PersonalEducationTable.EducationType.DefaultValue) End If ' If the EducationType is NULL or blank, then use the value specified ' on Properties. If Me.EducationType.Text Is Nothing _ OrElse Me.EducationType.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.EducationType.Text = " " End If End Sub Public Overridable Sub SetEdYear() ' Set the EdYear Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.EdYear is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetEdYear() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then ' If the EdYear is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.EdYear.Text = formattedValue Else ' EdYear is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue) End If ' If the EdYear is NULL or blank, then use the value specified ' on Properties. If Me.EdYear.Text Is Nothing _ OrElse Me.EdYear.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.EdYear.Text = " " End If End Sub Public Overridable Sub SetEndDate() ' Set the EndDate Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.EndDate is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetEndDate() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then ' If the EndDate is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy") formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.EndDate.Text = formattedValue Else ' EndDate is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.EndDate.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy") End If ' If the EndDate is NULL or blank, then use the value specified ' on Properties. If Me.EndDate.Text Is Nothing _ OrElse Me.EndDate.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.EndDate.Text = " " End If End Sub Public Overridable Sub SetFacultry() ' Set the Facultry Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.Facultry is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetFacultry() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then ' If the Facultry is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.Facultry.Text = formattedValue Else ' Facultry is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue) End If ' If the Facultry is NULL or blank, then use the value specified ' on Properties. If Me.Facultry.Text Is Nothing _ OrElse Me.Facultry.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.Facultry.Text = " " End If End Sub Public Overridable Sub SetInstitue() ' Set the Institue Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.Institue is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetInstitue() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then ' If the Institue is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.Institue.Text = formattedValue Else ' Institue is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue) End If ' If the Institue is NULL or blank, then use the value specified ' on Properties. If Me.Institue.Text Is Nothing _ OrElse Me.Institue.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.Institue.Text = " " End If End Sub Public Overridable Sub SetLevelId() ' Set the LevelId Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.LevelId is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetLevelId() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then ' If the LevelId is non-NULL, then format the value. ' The Format method will return the Display Foreign Key As (DFKA) value Dim formattedValue As String = "" Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.LevelId.ToString(),PersonalEducationTable.LevelId, Nothing) if (formattedValue Is Nothing) Then formattedValue = Me.DataSource.Format(PersonalEducationTable.LevelId) End If Else formattedValue = Me.DataSource.LevelId.ToString() End If formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.LevelId.Text = formattedValue Else ' LevelId is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.LevelId.Text = PersonalEducationTable.LevelId.Format(PersonalEducationTable.LevelId.DefaultValue) End If ' If the LevelId is NULL or blank, then use the value specified ' on Properties. If Me.LevelId.Text Is Nothing _ OrElse Me.LevelId.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.LevelId.Text = " " End If End Sub Public Overridable Sub SetNoAll() ' Set the NoAll Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.NoAll is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetNoAll() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then ' If the NoAll is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.NoAll.Text = formattedValue Else ' NoAll is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue) End If ' If the NoAll is NULL or blank, then use the value specified ' on Properties. If Me.NoAll.Text Is Nothing _ OrElse Me.NoAll.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.NoAll.Text = " " End If End Sub Public Overridable Sub SetPersonalId() ' Set the PersonalId LinkButton on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.PersonalId is the ASP:LinkButton on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetPersonalId() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then ' If the PersonalId is non-NULL, then format the value. ' The Format method will return the Display Foreign Key As (DFKA) value Dim formattedValue As String = "" Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then formattedValue = PersonalEducationTable.GetDFKA(Me.DataSource.PersonalId.ToString(),PersonalEducationTable.PersonalId, Nothing) if (formattedValue Is Nothing) Then formattedValue = Me.DataSource.Format(PersonalEducationTable.PersonalId) End If Else formattedValue = Me.DataSource.PersonalId.ToString() End If Me.PersonalId.Text = formattedValue Me.PersonalId.ToolTip = "Go to " & Me.PersonalId.Text.Replace("", "") Else ' PersonalId is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.PersonalId.Text = PersonalEducationTable.PersonalId.Format(PersonalEducationTable.PersonalId.DefaultValue) End If End Sub Public Overridable Sub SetScore() ' Set the Score Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.Score is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetScore() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then ' If the Score is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.Score.Text = formattedValue Else ' Score is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue) End If ' If the Score is NULL or blank, then use the value specified ' on Properties. If Me.Score.Text Is Nothing _ OrElse Me.Score.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.Score.Text = " " End If End Sub Public Overridable Sub SetScoreNo() ' Set the ScoreNo Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.ScoreNo is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetScoreNo() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then ' If the ScoreNo is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo) formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.ScoreNo.Text = formattedValue Else ' ScoreNo is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue) End If ' If the ScoreNo is NULL or blank, then use the value specified ' on Properties. If Me.ScoreNo.Text Is Nothing _ OrElse Me.ScoreNo.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.ScoreNo.Text = " " End If End Sub Public Overridable Sub SetStartDate() ' Set the StartDate Literal on the webpage with value from the ' PersonalEducation database record. ' Me.DataSource is the PersonalEducation record retrieved from the database. ' Me.StartDate is the ASP:Literal on the webpage. ' You can modify this method directly, or replace it with a call to ' MyBase.SetStartDate() ' and add your own code before or after the call to the MyBase function. If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then ' If the StartDate is non-NULL, then format the value. ' The Format method will use the Display Format Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy") formattedValue = HttpUtility.HtmlEncode(formattedValue) Me.StartDate.Text = formattedValue Else ' StartDate is NULL in the database, so use the Default Value. ' Default Value could also be NULL. Me.StartDate.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy") End If ' If the StartDate is NULL or blank, then use the value specified ' on Properties. If Me.StartDate.Text Is Nothing _ OrElse Me.StartDate.Text.Trim() = "" Then ' Set the value specified on the Properties. Me.StartDate.Text = " " End If End Sub Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String If e Is Nothing Then e = New FormulaEvaluator() End If e.Variables.Clear() ' add variables for formula evaluation If variables IsNot Nothing Then Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() While enumerator.MoveNext() e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) End While End If If includeDS End IF ' Other variables referred to in the formula are expected to be ' properties of the DataSource. For example, referring to ' UnitPrice as a variable will refer to DataSource.UnitPrice If dataSourceForEvaluate Is Nothing Then e.DataSource = Me.DataSource Else e.DataSource = dataSourceForEvaluate End If ' Define the calling control. This is used to add other ' related table and record controls as variables. e.CallingControl = Me Dim resultObj As Object = e.Evaluate(formula) If resultObj Is Nothing Then Return "" End If If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then Return FormulaUtils.Format(resultObj, format) Else Return resultObj.ToString() End If End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String) As String Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) End Function Public Overridable Sub RegisterPostback() End Sub ' To customize, override this method in PersonalEducationTableControlRow. Public Overridable Sub SaveData() ' Saves the associated record in the database. ' SaveData calls Validate and Get methods - so it may be more appropriate to ' customize those methods. ' 1. Load the existing record from the database. Since we save the entire record, this ensures ' that fields that are not displayed are also properly initialized. Me.LoadData() ' 2. Perform any custom validation. Me.Validate() ' 3. Set the values in the record with data from UI controls. ' This calls the Get() method for each of the user interface controls. Me.GetUIData() ' 4. Save in the database. ' We should not save the record if the data did not change. This ' will save a database hit and avoid triggering any database triggers. If Me.DataSource.IsAnyValueChanged Then ' Save record to database but do not commit yet. ' Auto generated ids are available after saving for use by child (dependent) records. Me.DataSource.Save() DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True End If ' update session or cookie by formula ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True Me.ResetData = True ' For Master-Detail relationships, save data on the Detail table(s) End Sub ' To customize, override this method in PersonalEducationTableControlRow. Public Overridable Sub GetUIData() ' The GetUIData method retrieves the updated values from the user interface ' controls into a database record in preparation for saving or updating. ' To do this, it calls the Get methods for each of the field displayed on ' the webpage. It is better to make changes in the Get methods, rather ' than making changes here. ' Call the Get methods for each of the user interface controls. GetCommand() GetCommandDate() GetCOUNTRY() GetCourse() GetCourseAbbr() GetCourseNo() GetEducationPeriod() GetEducationType() GetEdYear() GetEndDate() GetFacultry() GetInstitue() GetLevelId() GetNoAll() GetPersonalId() GetScore() GetScoreNo() GetStartDate() End Sub Public Overridable Sub GetCommand() End Sub Public Overridable Sub GetCommandDate() End Sub Public Overridable Sub GetCOUNTRY() End Sub Public Overridable Sub GetCourse() End Sub Public Overridable Sub GetCourseAbbr() End Sub Public Overridable Sub GetCourseNo() End Sub Public Overridable Sub GetEducationPeriod() End Sub Public Overridable Sub GetEducationType() End Sub Public Overridable Sub GetEdYear() End Sub Public Overridable Sub GetEndDate() End Sub Public Overridable Sub GetFacultry() End Sub Public Overridable Sub GetInstitue() End Sub Public Overridable Sub GetLevelId() End Sub Public Overridable Sub GetNoAll() End Sub Public Overridable Sub GetPersonalId() End Sub Public Overridable Sub GetScore() End Sub Public Overridable Sub GetScoreNo() End Sub Public Overridable Sub GetStartDate() End Sub ' To customize, override this method in PersonalEducationTableControlRow. Public Overridable Function CreateWhereClause() As WhereClause Return Nothing End Function ' To customize, override this method in PersonalEducationTableControlRow. Public Overridable Sub Validate() ' Add custom validation for any control within this panel. ' Example. If you have a State ASP:Textbox control ' If Me.State.Text <> "CA" Then ' Throw New Exception("State must be CA (California).") ' End If ' The Validate method is common across all controls within ' this panel so you can validate multiple fields, but report ' one error message. End Sub Public Overridable Sub Delete() If Me.IsNewRecord() Then Return End If Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId) PersonalEducationTable.DeleteRecord(pkValue) DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).DataChanged = True DirectCast(GetParentControlObject(Me, "PersonalEducationTableControl"), PersonalEducationTableControl).ResetData = True End Sub Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender ' PreRender event is raised just before page is being displayed. Try DbUtils.StartTransaction() Me.RegisterPostback() If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then ' Re-load the data and update the web page if necessary. ' This is typically done during a postback (filter, search button, sort, pagination button). ' In each of the other click handlers, simply set DataChanged to True to reload the data. Me.LoadData() Me.DataBind() End If Catch ex As Exception Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction() End Try End Sub Protected Overrides Sub SaveControlsToSession() MyBase.SaveControlsToSession() 'Save pagination state to session. End Sub Protected Overrides Sub ClearControlsFromSession() MyBase.ClearControlsFromSession() ' Clear pagination state from session. End Sub Protected Overrides Sub LoadViewState(ByVal savedState As Object) MyBase.LoadViewState(savedState) Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String) If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then Me.IsNewRecord = Boolean.Parse(isNewRecord) End If Dim myCheckSum As String = CType(ViewState("CheckSum"), String) If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then Me.CheckSum = myCheckSum End If ' Load view state for pagination control. End Sub Protected Overrides Function SaveViewState() As Object ViewState("IsNewRecord") = Me.IsNewRecord.ToString() ViewState("CheckSum") = Me.CheckSum ' Load view state for pagination control. Return MyBase.SaveViewState() End Function ' event handler for ImageButton Public Overridable Sub PersonalEducationRowCopyButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) ' The redirect URL is set on the Properties, Custom Properties or Actions. ' The ModifyRedirectURL call resolves the parameters before the ' Response.Redirect redirects the page to the URL. ' Any code after the Response.Redirect call will not be executed, since the page is ' redirected to the URL. Dim url As String = "../PersonalEducation/AddPersonalEducation.aspx?PersonalEducation={PK}" Dim shouldRedirect As Boolean = True Dim TargetKey As String = Nothing Dim DFKA As String = TargetKey Dim id As String = DFKA Dim value As String = id Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction url = Me.ModifyRedirectUrl(url, "",False) url = Me.Page.ModifyRedirectUrl(url, "",False) Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) shouldRedirect = False Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try If shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.Response.Redirect(url) ElseIf Not TargetKey Is Nothing AndAlso _ Not shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.CloseWindow(True) End If End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationRowDeleteButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction If(Not Me.Page.IsPageRefresh) Then Me.Delete() End If Me.Page.CommitTransaction(sender) Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationRowEditButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) ' The redirect URL is set on the Properties, Custom Properties or Actions. ' The ModifyRedirectURL call resolves the parameters before the ' Response.Redirect redirects the page to the URL. ' Any code after the Response.Redirect call will not be executed, since the page is ' redirected to the URL. Dim url As String = "../PersonalEducation/EditPersonalEducation.aspx?PersonalEducation={PK}" Dim shouldRedirect As Boolean = True Dim TargetKey As String = Nothing Dim DFKA As String = TargetKey Dim id As String = DFKA Dim value As String = id Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction url = Me.ModifyRedirectUrl(url, "",False) url = Me.Page.ModifyRedirectUrl(url, "",False) Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) shouldRedirect = False Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try If shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.Response.Redirect(url) ElseIf Not TargetKey Is Nothing AndAlso _ Not shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.CloseWindow(True) End If End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationRowViewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) ' The redirect URL is set on the Properties, Custom Properties or Actions. ' The ModifyRedirectURL call resolves the parameters before the ' Response.Redirect redirects the page to the URL. ' Any code after the Response.Redirect call will not be executed, since the page is ' redirected to the URL. Dim url As String = "../PersonalEducation/ShowPersonalEducation.aspx?PersonalEducation={PK}" Dim shouldRedirect As Boolean = True Dim TargetKey As String = Nothing Dim DFKA As String = TargetKey Dim id As String = DFKA Dim value As String = id Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction url = Me.ModifyRedirectUrl(url, "",False) url = Me.Page.ModifyRedirectUrl(url, "",False) Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) shouldRedirect = False Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try If shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.Response.Redirect(url) ElseIf Not TargetKey Is Nothing AndAlso _ Not shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.CloseWindow(True) End If End Sub ' event handler for LinkButton Public Overridable Sub PersonalId_Click(ByVal sender As Object, ByVal args As EventArgs) ' The redirect URL is set on the Properties, Custom Properties or Actions. ' The ModifyRedirectURL call resolves the parameters before the ' Response.Redirect redirects the page to the URL. ' Any code after the Response.Redirect call will not be executed, since the page is ' redirected to the URL. Dim url As String = "../PersonalId/ShowPersonalId.aspx?PersonalId={PersonalEducationTableControlRow:FK:FK_PersonalEducation_PersonalId}" Dim shouldRedirect As Boolean = True Dim TargetKey As String = Nothing Dim DFKA As String = TargetKey Dim id As String = DFKA Dim value As String = id Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction url = Me.ModifyRedirectUrl(url, "",False) url = Me.Page.ModifyRedirectUrl(url, "",False) Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) shouldRedirect = False Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try If shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.Response.Redirect(url) ElseIf Not TargetKey Is Nothing AndAlso _ Not shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.CloseWindow(True) End If End Sub Private _PreviousUIData As New Hashtable Public Overridable Property PreviousUIData() As Hashtable Get Return _PreviousUIData End Get Set(ByVal value As Hashtable) _PreviousUIData = value End Set End Property Private _IsNewRecord As Boolean = True Public Overridable Property IsNewRecord() As Boolean Get Return Me._IsNewRecord End Get Set(ByVal value As Boolean) Me._IsNewRecord = value End Set End Property Private _DataChanged As Boolean = False Public Overridable Property DataChanged() As Boolean Get Return Me._DataChanged End Get Set(ByVal Value As Boolean) Me._DataChanged = Value End Set End Property Private _ResetData As Boolean = False Public Overridable Property ResetData() As Boolean Get Return Me._ResetData End Get Set(ByVal Value As Boolean) Me._ResetData = Value End Set End Property Public Property RecordUniqueId() As String Get Return CType(Me.ViewState("BasePersonalEducationTableControlRow_Rec"), String) End Get Set(ByVal value As String) Me.ViewState("BasePersonalEducationTableControlRow_Rec") = value End Set End Property Private _DataSource As PersonalEducationRecord Public Property DataSource() As PersonalEducationRecord Get Return Me._DataSource End Get Set(ByVal value As PersonalEducationRecord) Me._DataSource = value End Set End Property Private _checkSum As String Public Overridable Property CheckSum() As String Get Return Me._checkSum End Get Set(ByVal value As String) Me._checkSum = value End Set End Property Private _TotalPages As Integer Public Property TotalPages() As Integer Get Return Me._TotalPages End Get Set(ByVal value As Integer) Me._TotalPages = value End Set End Property Private _PageIndex As Integer Public Property PageIndex() As Integer Get ' Return the PageIndex Return Me._PageIndex End Get Set(ByVal value As Integer) Me._PageIndex = value End Set End Property Private _DisplayLastPage As Boolean Public Property DisplayLastPage() As Boolean Get Return Me._DisplayLastPage End Get Set(ByVal value As Boolean) Me._DisplayLastPage = value End Set End Property #Region "Helper Properties" Public ReadOnly Property Command() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property Course() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property EducationType() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property EdYear() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property EndDate() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property Facultry() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property Institue() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property LevelId() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property NoAll() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property PersonalEducationRecordRowSelection() As System.Web.UI.WebControls.CheckBox Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordRowSelection"), System.Web.UI.WebControls.CheckBox) End Get End Property Public ReadOnly Property PersonalEducationRowCopyButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowCopyButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationRowDeleteButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowDeleteButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationRowEditButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowEditButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationRowViewButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRowViewButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property Score() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property StartDate() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.Literal) End Get End Property #End Region #Region "Helper Functions" Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) End Function Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String Dim rec As PersonalEducationRecord = Nothing Try rec = Me.GetRecord() Catch ex As Exception ' Do nothing End Try If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then ' Localization. Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons")) End If Return EvaluateExpressions(url, arg, rec, bEncrypt) End Function Public Overridable Function GetRecord() As PersonalEducationRecord If Not Me.DataSource Is Nothing Then Return Me.DataSource End If If Not Me.RecordUniqueId Is Nothing Then Return PersonalEducationTable.GetRecord(Me.RecordUniqueId, True) End If ' Localization. Throw New Exception(Page.GetResourceValue("Err:RetrieveRec", "Persons")) End Function Public Shadows ReadOnly Property Page() As BaseApplicationPage Get Return DirectCast(MyBase.Page, BaseApplicationPage) End Get End Property #End Region End Class ' Base class for the PersonalEducationTableControl control on the ShowPersonalEducationTable page. ' Do not modify this class. Instead override any method in PersonalEducationTableControl. Public Class BasePersonalEducationTableControl Inherits Persons.UI.BaseApplicationTableControl Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init ' Setup the filter and search events. AddHandler Me.COUNTRYFilter.SelectedIndexChanged, AddressOf COUNTRYFilter_SelectedIndexChanged AddHandler Me.LevelIdFilter.SelectedIndexChanged, AddressOf LevelIdFilter_SelectedIndexChanged AddHandler Me.PersonalIdFilter.SelectedIndexChanged, AddressOf PersonalIdFilter_SelectedIndexChanged If Not Me.Page.IsPostBack Then Dim initialVal As String = "" If Me.InSession(Me.COUNTRYFilter) initialVal = Me.GetFromSession(Me.COUNTRYFilter) End If If initialVal <> "" Me.COUNTRYFilter.Items.Add(New ListItem(initialVal, initialVal)) Me.COUNTRYFilter.SelectedValue = initialVal End If End If If Not Me.Page.IsPostBack Then Dim initialVal As String = "" If Me.InSession(Me.LevelIdFilter) initialVal = Me.GetFromSession(Me.LevelIdFilter) End If If initialVal <> "" Me.LevelIdFilter.Items.Add(New ListItem(initialVal, initialVal)) Me.LevelIdFilter.SelectedValue = initialVal End If End If If Not Me.Page.IsPostBack Then Dim initialVal As String = "" If Me.InSession(Me.PersonalEducationSearch) initialVal = Me.GetFromSession(Me.PersonalEducationSearch) End If If initialVal <> "" Me.PersonalEducationSearch.Text = initialVal End If End If If Not Me.Page.IsPostBack Then Dim initialVal As String = "" If Me.InSession(Me.PersonalIdFilter) initialVal = Me.GetFromSession(Me.PersonalIdFilter) End If If initialVal <> "" Me.PersonalIdFilter.Items.Add(New ListItem(initialVal, initialVal)) Me.PersonalIdFilter.SelectedValue = initialVal End If End If ' Control Initializations. ' Initialize the table's current sort order. If Me.InSession(Me, "Order_By") Then Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) Else Me.CurrentSortOrder = New OrderBy(True, False) Me.CurrentSortOrder.Add(PersonalEducationTable.PersonalId, OrderByItem.OrderDir.Asc) Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) End If ' Setup default pagination settings. Me.PageSize = CInt(Me.GetFromSession(Me, "Page_Size", "10")) Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0")) Me.ClearControlsFromSession() End Sub Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load SaveControlsToSession_Ajax() ' Setup the pagination events. AddHandler Me.PersonalEducationPagination.FirstPage.Click, AddressOf PersonalEducationPagination_FirstPage_Click AddHandler Me.PersonalEducationPagination.LastPage.Click, AddressOf PersonalEducationPagination_LastPage_Click AddHandler Me.PersonalEducationPagination.NextPage.Click, AddressOf PersonalEducationPagination_NextPage_Click AddHandler Me.PersonalEducationPagination.PageSizeButton.Click, AddressOf PersonalEducationPagination_PageSizeButton_Click AddHandler Me.PersonalEducationPagination.PreviousPage.Click, AddressOf PersonalEducationPagination_PreviousPage_Click ' Setup the sorting events. AddHandler Me.CommandDateLabel.Click, AddressOf CommandDateLabel_Click AddHandler Me.CommandLabel.Click, AddressOf CommandLabel_Click AddHandler Me.COUNTRYLabel.Click, AddressOf COUNTRYLabel_Click AddHandler Me.CourseAbbrLabel.Click, AddressOf CourseAbbrLabel_Click AddHandler Me.CourseLabel.Click, AddressOf CourseLabel_Click AddHandler Me.CourseNoLabel.Click, AddressOf CourseNoLabel_Click AddHandler Me.EducationPeriodLabel.Click, AddressOf EducationPeriodLabel_Click AddHandler Me.EducationTypeLabel.Click, AddressOf EducationTypeLabel_Click AddHandler Me.EdYearLabel.Click, AddressOf EdYearLabel_Click AddHandler Me.EndDateLabel.Click, AddressOf EndDateLabel_Click AddHandler Me.FacultryLabel.Click, AddressOf FacultryLabel_Click AddHandler Me.InstitueLabel.Click, AddressOf InstitueLabel_Click AddHandler Me.LevelIdLabel1.Click, AddressOf LevelIdLabel1_Click AddHandler Me.NoAllLabel.Click, AddressOf NoAllLabel_Click AddHandler Me.PersonalIdLabel1.Click, AddressOf PersonalIdLabel1_Click AddHandler Me.ScoreLabel.Click, AddressOf ScoreLabel_Click AddHandler Me.ScoreNoLabel.Click, AddressOf ScoreNoLabel_Click AddHandler Me.StartDateLabel.Click, AddressOf StartDateLabel_Click ' Setup the button events. AddHandler Me.PersonalEducationExportCSVButton.Click, AddressOf PersonalEducationExportCSVButton_Click AddHandler Me.PersonalEducationExportExcelButton.Click, AddressOf PersonalEducationExportExcelButton_Click AddHandler Me.PersonalEducationNewButton.Click, AddressOf PersonalEducationNewButton_Click AddHandler Me.PersonalEducationPDFButton.Click, AddressOf PersonalEducationPDFButton_Click AddHandler Me.PersonalEducationRefreshButton.Click, AddressOf PersonalEducationRefreshButton_Click AddHandler Me.PersonalEducationResetButton.Click, AddressOf PersonalEducationResetButton_Click AddHandler Me.PersonalEducationWordButton.Click, AddressOf PersonalEducationWordButton_Click AddHandler Me.PersonalEducationSearchButton.Button.Click, AddressOf PersonalEducationSearchButton_Click ' Setup events for others End Sub Public Overridable Sub LoadData() ' Read data from database. Returns an array of records that can be assigned ' to the DataSource table control property. Try Dim joinFilter As CompoundFilter = CreateCompoundJoinFilter() ' The WHERE clause will be empty when displaying all records in table. Dim wc As WhereClause = CreateWhereClause() If wc IsNot Nothing AndAlso Not wc.RunQuery Then ' Initialize an empty array of records Dim alist As New ArrayList(0) Me.DataSource = DirectCast(alist.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) ' Add records to the list if needed. Me.AddNewRecords() Me._TotalRecords = 0 Me._TotalPages = 0 Return End If ' Call OrderBy to determine the order - either use the order defined ' on the Query Wizard, or specified by user (by clicking on column heading) Dim orderBy As OrderBy = CreateOrderBy() ' Get the pagesize from the pagesize control. Me.GetPageSize() If Me.DisplayLastPage Then Dim totalRecords As Integer = If(Me._TotalRecords < 0, PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()), Me._TotalRecords) Dim totalPages As Integer = CInt(Math.Ceiling(totalRecords / Me.PageSize)) Me.PageIndex = totalPages - 1 End If ' Make sure PageIndex (current page) and PageSize are within bounds. If Me.PageIndex < 0 Then Me.PageIndex = 0 End If If Me.PageSize < 1 Then Me.PageSize = 1 End If ' Retrieve the records and set the table DataSource. ' Only PageSize records are fetched starting at PageIndex (zero based). If Me.AddNewRecord > 0 Then ' Make sure to preserve the previously entered data on new rows. Dim postdata As New ArrayList For Each rc As PersonalEducationTableControlRow In Me.GetRecordControls() If Not rc.IsNewRecord Then rc.DataSource = rc.GetRecord() rc.GetUIData() postdata.Add(rc.DataSource) UIData.Add(rc.PreservedUIData()) End If Next Me.DataSource = DirectCast(postdata.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) Else ' Get the records from the database Me.DataSource = PersonalEducationTable.GetRecords(joinFilter, wc, orderBy, Me.PageIndex, Me.PageSize) End If ' if the datasource contains no records contained in database, then load the last page. If (DbUtils.GetCreatedRecords(Me.DataSource).Length = 0 AndAlso Not Me.DisplayLastPage) Then Me.DisplayLastPage = True LoadData() Else ' Add any new rows desired by the user. Me.AddNewRecords() ' Turn off the ToggleAll checkbox Me.PersonalEducationToggleAll.Checked = False ' Initialize the page and grand totals. now End If Catch ex As Exception ' Report the error message to the end user Dim msg As String = ex.Message If ex.InnerException IsNot Nothing Then msg = msg & " InnerException: " & ex.InnerException.Message End If Throw New Exception(msg, ex.InnerException) End Try End Sub Public Overrides Sub DataBind() ' The DataBind method binds the user interface controls to the values ' from the database record for each row in the table. To do this, it calls the ' DataBind for each of the rows. ' DataBind also populates any filters above the table, and sets the pagination ' control to the correct number of records and the current page number. MyBase.DataBind() ' Make sure that the DataSource is initialized. If Me.DataSource Is Nothing Then Return End If 'LoadData for DataSource for chart and report if they exist ' Improve performance by prefetching display as records. Me.PreFetchForeignKeyValues() ' Setup the pagination controls. BindPaginationControls() ' Bind the repeater with the list of records to expand the UI. Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) If rep Is Nothing Then Return rep.DataSource = DataSource() rep.DataBind() Dim index As Integer = 0 For Each repItem As System.Web.UI.WebControls.RepeaterItem In rep.Items ' Loop through all rows in the table, set its DataSource and call DataBind(). Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) recControl.DataSource = Me.DataSource(index) If Me.UIData.Count > index Then recControl.PreviousUIData = Me.UIData(index) End If recControl.DataBind() recControl.Visible = Not Me.InDeletedRecordIds(recControl) index += 1 Next ' Call the Set methods for each controls on the panel SetCommandDateLabel() SetCommandLabel() SetCOUNTRYFilter() SetCOUNTRYLabel() SetCOUNTRYLabel1() SetCourseAbbrLabel() SetCourseLabel() SetCourseNoLabel() SetEducationPeriodLabel() SetEducationTypeLabel() SetEdYearLabel() SetEndDateLabel() SetFacultryLabel() SetInstitueLabel() SetLevelIdFilter() SetLevelIdLabel() SetLevelIdLabel1() SetNoAllLabel() SetPersonalEducationSearch() SetPersonalEducationTableControlCollapsibleRegion() SetPersonalEducationTableControlIcon() SetPersonalEducationTableControlPanelExtender() SetPersonalIdFilter() SetPersonalIdLabel() SetPersonalIdLabel1() SetScoreLabel() SetScoreNoLabel() SetStartDateLabel() ' setting the state of expand or collapse alternative rows ' Load data for each record and table UI control. ' Ordering is important because child controls get ' their parent ids from their parent UI controls. ' this method calls the set method for controls with special formula like running total, sum, rank, etc SetFormulaControls() End Sub Public Overridable Sub SetFormulaControls() ' this method calls Set methods for the control that has special formula End Sub Public Sub PreFetchForeignKeyValues() If (IsNothing(Me.DataSource)) Return End If Me.Page.PregetDfkaRecords(PersonalEducationTable.COUNTRY, Me.DataSource) Me.Page.PregetDfkaRecords(PersonalEducationTable.EducationPeriod, Me.DataSource) Me.Page.PregetDfkaRecords(PersonalEducationTable.LevelId, Me.DataSource) Me.Page.PregetDfkaRecords(PersonalEducationTable.PersonalId, Me.DataSource) End Sub Public Overridable Sub RegisterPostback() Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationExportCSVButton")) Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationExportExcelButton")) Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationPDFButton")) Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalEducationWordButton")) End Sub Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula) Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e as FormulaEvaluator) As String If e Is Nothing e = New FormulaEvaluator() End If e.Variables.Clear() ' add variables for formula evaluation If variables IsNot Nothing Then Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator() While enumerator.MoveNext() e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value) End While End If If includeDS End If ' All variables referred to in the formula are expected to be ' properties of the DataSource. For example, referring to ' UnitPrice as a variable will refer to DataSource.UnitPrice e.DataSource = dataSourceForEvaluate ' Define the calling control. This is used to add other ' related table and record controls as variables. e.CallingControl = Me Dim resultObj As Object = e.Evaluate(formula) If resultObj Is Nothing Then Return "" End If If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then Return FormulaUtils.Format(resultObj, format) Else Return resultObj.ToString() End If End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing) End Function Public Overridable Function EvaluateFormula(ByVal formula As String) As String Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing) End Function Public Overridable Sub ResetControl() Me.COUNTRYFilter.ClearSelection() Me.LevelIdFilter.ClearSelection() Me.PersonalIdFilter.ClearSelection() Me.PersonalEducationSearch.Text = "" Me.CurrentSortOrder.Reset() If (Me.InSession(Me, "Order_By")) Then Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) Else Me.CurrentSortOrder = New OrderBy(True, False) Me.CurrentSortOrder.Add(PersonalEducationTable.PersonalId, OrderByItem.OrderDir.Asc) Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) End If Me.PageIndex = 0 End Sub Protected Overridable Sub BindPaginationControls() ' Setup the pagination controls. ' Bind the pagination labels. If DbUtils.GetCreatedRecords(Me.DataSource).Length > 0 Then Me.PersonalEducationPagination.CurrentPage.Text = (Me.PageIndex + 1).ToString() Else Me.PersonalEducationPagination.CurrentPage.Text = "0" End If Me.PersonalEducationPagination.PageSize.Text = Me.PageSize.ToString() Me.PersonalEducationPagination.TotalItems.Text = Me.TotalRecords.ToString() Me.PersonalEducationPagination.TotalPages.Text = Me.TotalPages.ToString() ' Bind the buttons for PersonalEducationTableControl pagination. Me.PersonalEducationPagination.FirstPage.Enabled = Not (Me.PageIndex = 0) If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons Me.PersonalEducationPagination.LastPage.Enabled = True ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons Me.PersonalEducationPagination.LastPage.Enabled = False Else ' if the total pages is the last page, disable last and next buttons Me.PersonalEducationPagination.LastPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) End If If Me._TotalPages < 0 Then ' if the total pages is not determined yet, enable last and next buttons Me.PersonalEducationPagination.NextPage.Enabled = True ElseIf Me._TotalPages = 0 ' if the total pages is determined and it is 0, enable last and next buttons Me.PersonalEducationPagination.NextPage.Enabled = False Else ' if the total pages is the last page, disable last and next buttons Me.PersonalEducationPagination.NextPage.Enabled = Not (Me.PageIndex = Me.TotalPages - 1) End If Me.PersonalEducationPagination.PreviousPage.Enabled = Not (Me.PageIndex = 0) End Sub Public Overridable Sub SaveData() ' Save the data from the entire table. Calls each row's Save Data ' to save their data. This function is called by the Click handler of the ' Save button. The button handler should Start/Commit/End a transaction. Dim recCtl As PersonalEducationTableControlRow For Each recCtl In Me.GetRecordControls() If Me.InDeletedRecordIds(recCtl) Then ' Delete any pending deletes. recCtl.Delete() Else If recCtl.Visible Then recCtl.SaveData() End If End If Next ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True Me.ResetData = True ' Set IsNewRecord to False for all records - since everything has been saved and is no longer "new" For Each recCtl In Me.GetRecordControls() recCtl.IsNewRecord = False Next ' Set DeletedRecordsIds to Nothing since we have deleted all pending deletes. Me.DeletedRecordIds = Nothing End Sub Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter Dim jFilter As CompoundFilter = New CompoundFilter() Return jFilter End Function Public Overridable Function CreateOrderBy() As OrderBy ' The CurrentSortOrder is initialized to the sort order on the ' Query Wizard. It may be modified by the Click handler for any of ' the column heading to sort or reverse sort by that column. ' You can add your own sort order, or modify it on the Query Wizard. Return Me.CurrentSortOrder End Function Public Overridable Function CreateWhereClause() As WhereClause 'This CreateWhereClause is used for loading the data. PersonalEducationTable.Instance.InnerFilter = Nothing Dim wc As WhereClause = New WhereClause() ' Compose the WHERE clause consiting of: ' 1. Static clause defined at design time. ' 2. User selected search criteria. ' 3. User selected filter criteria. If IsValueSelected(Me.COUNTRYFilter) Then wc.iAND(PersonalEducationTable.COUNTRY, BaseFilter.ComparisonOperator.Not_Equals, MiscUtils.GetSelectedValue(Me.COUNTRYFilter, Me.GetFromSession(Me.COUNTRYFilter)), False, False) End If If IsValueSelected(Me.LevelIdFilter) Then wc.iAND(PersonalEducationTable.LevelId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.LevelIdFilter, Me.GetFromSession(Me.LevelIdFilter)), False, False) End If If IsValueSelected(Me.PersonalEducationSearch) Then If Me.PersonalEducationSearch.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then Me.PersonalEducationSearch.Text = "" Else ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. If Me.PersonalEducationSearch.Text.StartsWith("...") Then Me.PersonalEducationSearch.Text = Me.PersonalEducationSearch.Text.SubString(3,Me.PersonalEducationSearch.Text.Length-3) End If If Me.PersonalEducationSearch.Text.EndsWith("...") then Me.PersonalEducationSearch.Text = Me.PersonalEducationSearch.Text.SubString(0,Me.PersonalEducationSearch.Text.Length-3) ' Strip the last word as well as it is likely only a partial word Dim endindex As Integer = PersonalEducationSearch.Text.Length - 1 While (Not Char.IsWhiteSpace(PersonalEducationSearch.Text(endindex)) AndAlso endindex > 0) endindex -= 1 End While If endindex > 0 Then PersonalEducationSearch.Text = PersonalEducationSearch.Text.Substring(0, endindex) End If End If End If Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalEducationSearch, Me.GetFromSession(Me.PersonalEducationSearch)) ' After stripping "..." see if the search text is null or empty. If IsValueSelected(Me.PersonalEducationSearch) Then ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. Dim search As WhereClause = New WhereClause() search.iOR(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalEducationSearch, Me.GetFromSession(Me.PersonalEducationSearch)), True, False) wc.iAND(search) End If End If If IsValueSelected(Me.PersonalIdFilter) Then wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, MiscUtils.GetSelectedValue(Me.PersonalIdFilter, Me.GetFromSession(Me.PersonalIdFilter)), False, False) End If Return wc End Function Public Overridable Function CreateWhereClause(ByVal searchText as String, ByVal fromSearchControl as String, ByVal AutoTypeAheadSearch as String, ByVal AutoTypeAheadWordSeparators as String) As WhereClause ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature. PersonalEducationTable.Instance.InnerFilter = Nothing Dim wc As WhereClause = New WhereClause() ' Compose the WHERE clause consiting of: ' 1. Static clause defined at design time. ' 2. User selected search criteria. ' 3. User selected filter criteria. Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String) ' Adds clauses if values are selected in Filter controls which are configured in the page. Dim COUNTRYFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "COUNTRYFilter_Ajax"), String) If IsValueSelected(COUNTRYFilterSelectedValue) Then wc.iAND(PersonalEducationTable.COUNTRY, BaseFilter.ComparisonOperator.Not_Equals, COUNTRYFilterSelectedValue, false, False) End If Dim LevelIdFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "LevelIdFilter_Ajax"), String) If IsValueSelected(LevelIdFilterSelectedValue) Then wc.iAND(PersonalEducationTable.LevelId, BaseFilter.ComparisonOperator.EqualsTo, LevelIdFilterSelectedValue, false, False) End If If IsValueSelected(searchText) and fromSearchControl = "PersonalEducationSearch" Then Dim formatedSearchText as String = searchText ' Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored. If searchText.StartsWith("...") Then formatedSearchText = searchText.SubString(3,searchText.Length-3) End If If searchText.EndsWith("...") Then formatedSearchText = searchText.SubString(0,searchText.Length-3) ' Strip the last word as well as it is likely only a partial word Dim endindex As Integer = searchText.Length - 1 While (Not Char.IsWhiteSpace(searchText(endindex)) AndAlso endindex > 0) endindex -= 1 End While If endindex > 0 Then searchText = searchText.Substring(0, endindex) End If End If 'After stripping "...", trim any leading and trailing whitespaces formatedSearchText = formatedSearchText.Trim() ' After stripping "..." see if the search text is null or empty. If IsValueSelected(formatedSearchText) Then ' These clauses are added depending on operator and fields selected in Control's property page, bindings tab. Dim search As WhereClause = New WhereClause() If InvariantLCase(AutoTypeAheadSearch).equals("wordsstartingwithsearchstring") Then search.iOR(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False) search.iOR(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False) Else search.iOR(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False) End If wc.iAND(search) End If End If Dim PersonalIdFilterSelectedValue As String = CType(HttpContext.Current.Session()(HttpContext.Current.Session.SessionID & appRelativeVirtualPath & "PersonalIdFilter_Ajax"), String) If IsValueSelected(PersonalIdFilterSelectedValue) Then wc.iAND(PersonalEducationTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, PersonalIdFilterSelectedValue, false, False) End If Return wc End Function Public Overridable Function GetAutoCompletionList_PersonalEducationSearch(ByVal prefixText As String, ByVal count As Integer) As String() Dim resultList As ArrayList = New ArrayList Dim wordList As ArrayList = New ArrayList Dim iteration As Integer = 0 Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter() Dim wc As WhereClause = CreateWhereClause(prefixText,"PersonalEducationSearch", "WordsStartingWithSearchString", "[^a-zA-Z0-9]") While (resultList.Count < count AndAlso iteration < 5) ' Fetch 100 records in each iteration Dim recordList () As Persons.Business.PersonalEducationRecord = PersonalEducationTable.GetRecords(filterJoin, wc, Nothing, iteration, 100) Dim rec As PersonalEducationRecord = Nothing Dim resultItem As String = "" For Each rec In recordList ' Exit the loop if recordList count has reached AutoTypeAheadListSize. If resultList.Count >= count then Exit For End If ' If the field is configured to Display as Foreign key, Format() method returns the ' Display as Forien Key value instead of original field value. ' Since search had to be done in multiple fields (selected in Control's page property, binding tab) in a record, ' We need to find relevent field to display which matches the prefixText and is not already present in the result list. resultItem = rec.Format(PersonalEducationTable.PersonalId) If resultItem IsNot Nothing AndAlso resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).Contains(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Then Dim isAdded As Boolean = FormatSuggestions(prefixText, resultItem, 50, "AtBeginningOfMatchedString", "WordsStartingWithSearchString", "[^a-zA-Z0-9]", resultList) If isAdded Then Continue For End If End If Next ' Exit the loop if number of records found is less as further iteration will not return any more records If recordList .Length < 100 Then Exit While End If iteration += 1 End While resultList.Sort() Dim result() As String = New String(resultList.Count - 1) {} Array.Copy(resultList.ToArray, result, resultList.Count) Return result End Function Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _ ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _ ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _ ByVal resultList As ArrayList) As Boolean 'Formats the resultItem and adds it to the list of suggestions. Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture)) Dim itemToAdd As String = "" Dim isFound As Boolean = False Dim isAdded As Boolean = False ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText. If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") And Not index = 0 Then ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) If regex1.IsMatch(resultItem) Then index = regex1.Match(resultItem).Index isFound = True End If ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further If not resultItem(index).ToString() = " " Then ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) If regex.IsMatch(resultItem) Then index = regex.Match(resultItem).Index isFound = True End If End If End If ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then ' Expression to find beginning of the word which contains prefixText Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase) ' Find the beginning of the word which contains prefexText If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then index = regex1.Match(resultItem).Index isFound = True End If ' Display string from the index till end of the string if sub string from index till end is less than columnLength value. If Len(resultItem) - index <= columnLength Then If index = 0 Then itemToAdd = resultItem Else itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) End If Else If index = 0 Then itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..." Else 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." End If End If ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer) If Len(resultItem) <= columnLength Then itemToAdd = resultItem Else ' Sanity check at end of the string If index + Len(prefixText) = columnLength Then itemToAdd = "..." & resultItem.Substring(index-columnLength,index) ElseIf Len(resultItem) - index < subStringBeginIndex Then ' Display string from the end till columnLength value if, index is closer to the end of the string. itemToAdd = "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem)) ElseIf index <= subStringBeginIndex Then ' Sanity chet at beginning of the string itemToAdd = resultItem.Substring(0, columnLength) & "..." Else ' Display string containing text before the prefixText occures and text after the prefixText itemToAdd = "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." End If End If ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then ' Expression to find ending of the word which contains prefexText Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase) ' Find the ending of the word which contains prefexText If regex1.IsMatch(resultItem, index + 1) Then index = regex1.Match(resultItem, index + 1).Index Else ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false. index = resultItem.Length End If If index > Len(resultItem) Then index = Len(resultItem) End If ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index. If index <= columnLength Then if index = Len(resultItem) Then 'Make decision to append "..." itemToAdd = resultItem.Substring(0,index) Else itemToAdd = resultItem.Substring(0,index) & "..." End If Else If index = Len(resultItem) Then itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3)) Else 'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended. itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." End If End If End If ' Remove newline character from itemToAdd Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase) ' If itemToAdd contains any newline after the search text then show text only till newline Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase) Dim newLineIndexAfterPrefix As Integer = -1 If regex2.IsMatch(itemToAdd, prefixTextIndex) Then newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index End If If (newLineIndexAfterPrefix > -1) Then If itemToAdd.EndsWith("...") Then itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...") Else itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix) End If End If ' If itemToAdd contains any newline before search text then show text which comes after newline Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft)) Dim newLineIndexBeforePrefix As Integer = -1 If regex3.IsMatch(itemToAdd, prefixTextIndex) Then newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index End If If (newLineIndexBeforePrefix > -1) Then If itemToAdd.StartsWith("...") Then itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))) Else itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)) End If End If If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then resultList.Add(itemToAdd) isAdded = true End If End If Return isAdded End Function Protected Overridable Sub GetPageSize() If Me.PersonalEducationPagination.PageSize.Text.Trim <> "" Then Try 'Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) Catch ex As Exception End Try End If End Sub Protected Overridable Sub AddNewRecords() Dim newRecordList As ArrayList = New ArrayList() Dim newUIDataList As System.Collections.Generic.List(Of Hashtable) = New System.Collections.Generic.List(Of Hashtable)() ' Loop though all the record controls and if the record control ' does not have a unique record id set, then create a record ' and add to the list. If Not Me.ResetData Then Dim rep As System.Web.UI.WebControls.Repeater = CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) If rep Is Nothing Then Return Dim repItem As System.Web.UI.WebControls.RepeaterItem For Each repItem In rep.Items ' Loop through all rows in the table, set its DataSource and call DataBind(). Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) If recControl.Visible AndAlso recControl.IsNewRecord() Then Dim rec As PersonalEducationRecord = New PersonalEducationRecord() If recControl.Command.Text <> "" Then rec.Parse(recControl.Command.Text, PersonalEducationTable.Command) End If If recControl.CommandDate.Text <> "" Then rec.Parse(recControl.CommandDate.Text, PersonalEducationTable.CommandDate) End If If recControl.COUNTRY.Text <> "" Then rec.Parse(recControl.COUNTRY.Text, PersonalEducationTable.COUNTRY) End If If recControl.Course.Text <> "" Then rec.Parse(recControl.Course.Text, PersonalEducationTable.Course) End If If recControl.CourseAbbr.Text <> "" Then rec.Parse(recControl.CourseAbbr.Text, PersonalEducationTable.CourseAbbr) End If If recControl.CourseNo.Text <> "" Then rec.Parse(recControl.CourseNo.Text, PersonalEducationTable.CourseNo) End If If recControl.EducationPeriod.Text <> "" Then rec.Parse(recControl.EducationPeriod.Text, PersonalEducationTable.EducationPeriod) End If If recControl.EducationType.Text <> "" Then rec.Parse(recControl.EducationType.Text, PersonalEducationTable.EducationType) End If If recControl.EdYear.Text <> "" Then rec.Parse(recControl.EdYear.Text, PersonalEducationTable.EdYear) End If If recControl.EndDate.Text <> "" Then rec.Parse(recControl.EndDate.Text, PersonalEducationTable.EndDate) End If If recControl.Facultry.Text <> "" Then rec.Parse(recControl.Facultry.Text, PersonalEducationTable.Facultry) End If If recControl.Institue.Text <> "" Then rec.Parse(recControl.Institue.Text, PersonalEducationTable.Institue) End If If recControl.LevelId.Text <> "" Then rec.Parse(recControl.LevelId.Text, PersonalEducationTable.LevelId) End If If recControl.NoAll.Text <> "" Then rec.Parse(recControl.NoAll.Text, PersonalEducationTable.NoAll) End If If recControl.PersonalId.Text <> "" Then rec.Parse(recControl.PersonalId.Text, PersonalEducationTable.PersonalId) End If If recControl.Score.Text <> "" Then rec.Parse(recControl.Score.Text, PersonalEducationTable.Score) End If If recControl.ScoreNo.Text <> "" Then rec.Parse(recControl.ScoreNo.Text, PersonalEducationTable.ScoreNo) End If If recControl.StartDate.Text <> "" Then rec.Parse(recControl.StartDate.Text, PersonalEducationTable.StartDate) End If newUIDataList.Add(recControl.PreservedUIData()) newRecordList.Add(rec) End If Next End If ' Add any new record to the list. Dim index As Integer = 0 For index = 1 To Me.AddNewRecord newRecordList.Insert(0, New PersonalEducationRecord()) newUIDataList.Insert(0, New Hashtable()) Next Me.AddNewRecord = 0 ' Finally, add any new records to the DataSource. If newRecordList.Count > 0 Then Dim finalList As ArrayList = New ArrayList(Me.DataSource) finalList.InsertRange(0, newRecordList) Me.DataSource = DirectCast(finalList.ToArray(GetType(PersonalEducationRecord)), PersonalEducationRecord()) End If ' Add the existing UI data to this hash table If newUIDataList.Count > 0 Then Me.UIData.InsertRange(0, newUIDataList) End If End Sub Public Sub AddToDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) If rec.IsNewRecord() Then Return End If If Not Me.DeletedRecordIds Is Nothing AndAlso Me.DeletedRecordIds.Trim <> "" Then Me.DeletedRecordIds &= "," End If Me.DeletedRecordIds &= "[" & rec.RecordUniqueId & "]" End Sub Protected Overridable Function InDeletedRecordIds(ByVal rec As PersonalEducationTableControlRow) As Boolean If Me.DeletedRecordIds Is Nothing OrElse Me.DeletedRecordIds.Trim = "" Then Return False End If Return Me.DeletedRecordIds.IndexOf("[" & rec.RecordUniqueId & "]") >= 0 End Function Private _DeletedRecordIds As String Public Property DeletedRecordIds() As String Get Return Me._DeletedRecordIds End Get Set(ByVal value As String) Me._DeletedRecordIds = value End Set End Property ' Create Set, WhereClause, and Populate Methods Public Overridable Sub SetCommandDateLabel() End Sub Public Overridable Sub SetCommandLabel() End Sub Public Overridable Sub SetCOUNTRYLabel() End Sub Public Overridable Sub SetCOUNTRYLabel1() 'Code for the text property is generated inside the .aspx file. 'To override this property you can uncomment the following property and add your own value. 'Me.COUNTRYLabel1.Text = "Some value" End Sub Public Overridable Sub SetCourseAbbrLabel() End Sub Public Overridable Sub SetCourseLabel() End Sub Public Overridable Sub SetCourseNoLabel() End Sub Public Overridable Sub SetEducationPeriodLabel() End Sub Public Overridable Sub SetEducationTypeLabel() End Sub Public Overridable Sub SetEdYearLabel() End Sub Public Overridable Sub SetEndDateLabel() End Sub Public Overridable Sub SetFacultryLabel() End Sub Public Overridable Sub SetInstitueLabel() End Sub Public Overridable Sub SetLevelIdLabel() End Sub Public Overridable Sub SetLevelIdLabel1() End Sub Public Overridable Sub SetNoAllLabel() End Sub Public Overridable Sub SetPersonalEducationTableControlCollapsibleRegion() End Sub Public Overridable Sub SetPersonalEducationTableControlIcon() End Sub Public Overridable Sub SetPersonalEducationTableControlPanelExtender() End Sub Public Overridable Sub SetPersonalIdLabel() End Sub Public Overridable Sub SetPersonalIdLabel1() End Sub Public Overridable Sub SetScoreLabel() End Sub Public Overridable Sub SetScoreNoLabel() End Sub Public Overridable Sub SetStartDateLabel() End Sub Public Overridable Sub SetCOUNTRYFilter() Me.PopulateCOUNTRYFilter(GetSelectedValue(Me.COUNTRYFilter, GetFromSession(Me.COUNTRYFilter)), 500) End Sub Public Overridable Sub SetLevelIdFilter() Me.PopulateLevelIdFilter(GetSelectedValue(Me.LevelIdFilter, GetFromSession(Me.LevelIdFilter)), 500) End Sub Public Overridable Sub SetPersonalEducationSearch() End Sub Public Overridable Sub SetPersonalIdFilter() Me.PopulatePersonalIdFilter(GetSelectedValue(Me.PersonalIdFilter, GetFromSession(Me.PersonalIdFilter)), 500) End Sub ' Get the filters' data for COUNTRYFilter Protected Overridable Sub PopulateCOUNTRYFilter(ByVal selectedValue As String, ByVal maxItems As Integer) Me.COUNTRYFilter.Items.Clear() ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_COUNTRYFilter function. ' It is better to customize the where clause there. 'Setup the WHERE clause. Dim wc As WhereClause = Me.CreateWhereClause_COUNTRYFilter() ' Setup the static list items ' Add the All item. Me.COUNTRYFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) Dim orderBy As OrderBy = New OrderBy(false, false) orderBy.Add(CountryTable.Country, OrderByItem.OrderDir.Asc) Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") Dim itemValues() As CountryRecord = Nothing If wc.RunQuery Dim counter As Integer = 0 Dim pageNum As Integer = 0 Dim evaluator As New FormulaEvaluator Dim listDuplicates As New ArrayList() Do itemValues = CountryTable.GetRecords(wc, orderBy, pageNum, maxItems) For each itemValue As CountryRecord In itemValues ' Create the item and add to the list. Dim cvalue As String = Nothing Dim fvalue As String = Nothing If itemValue.CountryIdSpecified Then cvalue = itemValue.CountryId.ToString() If counter < maxItems AndAlso Me.COUNTRYFilter.Items.FindByValue(cvalue) Is Nothing Then Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY) End If If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then fvalue = itemValue.Format(CountryTable.Country) End If If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue If (IsNothing(fvalue)) Then fvalue = "" End If fvalue = fvalue.Trim() If ( fvalue.Length > 50 ) Then fvalue = fvalue.Substring(0, 50) & "..." End If Dim dupItem As ListItem = Me.COUNTRYFilter.Items.FindByText(fvalue) If Not IsNothing(dupItem) Then listDuplicates.Add(fvalue) dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" End If Dim newItem As ListItem = New ListItem(fvalue, cvalue) Me.COUNTRYFilter.Items.Add(newItem) If listDuplicates.Contains(fvalue) Then newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" End If counter += 1 End If End If Next pageNum += 1 Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) End If ' Set the selected value. SetSelectedValue(Me.COUNTRYFilter, selectedValue) End Sub ' Get the filters' data for LevelIdFilter Protected Overridable Sub PopulateLevelIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) Me.LevelIdFilter.Items.Clear() ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_LevelIdFilter function. ' It is better to customize the where clause there. 'Setup the WHERE clause. Dim wc As WhereClause = Me.CreateWhereClause_LevelIdFilter() ' Setup the static list items ' Add the All item. Me.LevelIdFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) Dim orderBy As OrderBy = New OrderBy(false, false) orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc) Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") Dim itemValues() As EducationRecord = Nothing If wc.RunQuery Dim counter As Integer = 0 Dim pageNum As Integer = 0 Dim evaluator As New FormulaEvaluator Dim listDuplicates As New ArrayList() Do itemValues = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems) For each itemValue As EducationRecord In itemValues ' Create the item and add to the list. Dim cvalue As String = Nothing Dim fvalue As String = Nothing If itemValue.EducationIdSpecified Then cvalue = itemValue.EducationId.ToString() If counter < maxItems AndAlso Me.LevelIdFilter.Items.FindByValue(cvalue) Is Nothing Then Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId) End If If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then fvalue = itemValue.Format(EducationTable.Level) End If If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue If (IsNothing(fvalue)) Then fvalue = "" End If fvalue = fvalue.Trim() If ( fvalue.Length > 50 ) Then fvalue = fvalue.Substring(0, 50) & "..." End If Dim dupItem As ListItem = Me.LevelIdFilter.Items.FindByText(fvalue) If Not IsNothing(dupItem) Then listDuplicates.Add(fvalue) dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" End If Dim newItem As ListItem = New ListItem(fvalue, cvalue) Me.LevelIdFilter.Items.Add(newItem) If listDuplicates.Contains(fvalue) Then newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" End If counter += 1 End If End If Next pageNum += 1 Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) End If ' Set the selected value. SetSelectedValue(Me.LevelIdFilter, selectedValue) End Sub ' Get the filters' data for PersonalIdFilter Protected Overridable Sub PopulatePersonalIdFilter(ByVal selectedValue As String, ByVal maxItems As Integer) Me.PersonalIdFilter.Items.Clear() ' Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_PersonalIdFilter function. ' It is better to customize the where clause there. 'Setup the WHERE clause. Dim wc As WhereClause = Me.CreateWhereClause_PersonalIdFilter() ' Setup the static list items ' Add the All item. Me.PersonalIdFilter.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:All", "Persons"), "--ANY--")) Dim orderBy As OrderBy = New OrderBy(false, false) orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc) Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object) Dim noValueFormat As String = Page.GetResourceValue("Txt:Other", "Persons") Dim itemValues() As PersonalIdRecord = Nothing If wc.RunQuery Dim counter As Integer = 0 Dim pageNum As Integer = 0 Dim evaluator As New FormulaEvaluator Dim listDuplicates As New ArrayList() Do itemValues = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems) For each itemValue As PersonalIdRecord In itemValues ' Create the item and add to the list. Dim cvalue As String = Nothing Dim fvalue As String = Nothing If itemValue.PersonalIdSpecified Then cvalue = itemValue.PersonalId.ToString() If counter < maxItems AndAlso Me.PersonalIdFilter.Items.FindByValue(cvalue) Is Nothing Then Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId) End If If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then fvalue = itemValue.Format(PersonalIdTable.PersonalName) End If If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue If (IsNothing(fvalue)) Then fvalue = "" End If fvalue = fvalue.Trim() If ( fvalue.Length > 50 ) Then fvalue = fvalue.Substring(0, 50) & "..." End If Dim dupItem As ListItem = Me.PersonalIdFilter.Items.FindByText(fvalue) If Not IsNothing(dupItem) Then listDuplicates.Add(fvalue) dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")" End If Dim newItem As ListItem = New ListItem(fvalue, cvalue) Me.PersonalIdFilter.Items.Add(newItem) If listDuplicates.Contains(fvalue) Then newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")" End If counter += 1 End If End If Next pageNum += 1 Loop While (itemValues.Length = maxItems AndAlso counter < maxItems) End If ' Set the selected value. SetSelectedValue(Me.PersonalIdFilter, selectedValue) End Sub Public Overridable Function CreateWhereClause_COUNTRYFilter() As WhereClause ' Create a where clause for the filter COUNTRYFilter. ' This function is called by the Populate method to load the items ' in the COUNTRYFilterDropDownList Dim wc As WhereClause= New WhereClause() Return wc End Function Public Overridable Function CreateWhereClause_LevelIdFilter() As WhereClause ' Create a where clause for the filter LevelIdFilter. ' This function is called by the Populate method to load the items ' in the LevelIdFilterDropDownList Dim wc As WhereClause= New WhereClause() Return wc End Function Public Overridable Function CreateWhereClause_PersonalIdFilter() As WhereClause ' Create a where clause for the filter PersonalIdFilter. ' This function is called by the Populate method to load the items ' in the PersonalIdFilterDropDownList Dim wc As WhereClause= New WhereClause() Return wc End Function Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender ' PreRender event is raised just before page is being displayed. Try DbUtils.StartTransaction Me.RegisterPostback() If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then ' Re-load the data and update the web page if necessary. ' This is typically done during a postback (filter, search button, sort, pagination button). ' In each of the other click handlers, simply set DataChanged to True to reload the data. Me.LoadData() Me.DataBind() End If Catch ex As Exception Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try End Sub Protected Overrides Sub SaveControlsToSession() MyBase.SaveControlsToSession() ' Save filter controls to values to session. Me.SaveToSession(Me.COUNTRYFilter, Me.COUNTRYFilter.SelectedValue) Me.SaveToSession(Me.LevelIdFilter, Me.LevelIdFilter.SelectedValue) Me.SaveToSession(Me.PersonalEducationSearch, Me.PersonalEducationSearch.Text) Me.SaveToSession(Me.PersonalIdFilter, Me.PersonalIdFilter.SelectedValue) 'Save pagination state to session. ' Save table control properties to the session. If Not Me.CurrentSortOrder Is Nothing Then Me.SaveToSession(Me, "Order_By", Me.CurrentSortOrder.ToXmlString()) End If Me.SaveToSession(Me, "Page_Index", Me.PageIndex.ToString()) Me.SaveToSession(Me, "Page_Size", Me.PageSize.ToString()) Me.SaveToSession(Me, "DeletedRecordIds", Me.DeletedRecordIds) End Sub Protected Sub SaveControlsToSession_Ajax() ' Save filter controls to values to session. Me.SaveToSession("COUNTRYFilter_Ajax", Me.COUNTRYFilter.SelectedValue) Me.SaveToSession("LevelIdFilter_Ajax", Me.LevelIdFilter.SelectedValue) Me.SaveToSession("PersonalEducationSearch_Ajax", Me.PersonalEducationSearch.Text) Me.SaveToSession("PersonalIdFilter_Ajax", Me.PersonalIdFilter.SelectedValue) HttpContext.Current.Session("AppRelativeVirtualPath") = Me.Page.AppRelativeVirtualPath End Sub Protected Overrides Sub ClearControlsFromSession() MyBase.ClearControlsFromSession() ' Clear filter controls values from the session. Me.RemoveFromSession(Me.COUNTRYFilter) Me.RemoveFromSession(Me.LevelIdFilter) Me.RemoveFromSession(Me.PersonalEducationSearch) Me.RemoveFromSession(Me.PersonalIdFilter) ' Clear pagination state from session. ' Clear table properties from the session. Me.RemoveFromSession(Me, "Order_By") Me.RemoveFromSession(Me, "Page_Index") Me.RemoveFromSession(Me, "Page_Size") Me.RemoveFromSession(Me, "DeletedRecordIds") End Sub Protected Overrides Sub LoadViewState(ByVal savedState As Object) MyBase.LoadViewState(savedState) Dim orderByStr As String = CType(ViewState("PersonalEducationTableControl_OrderBy"), String) If orderByStr IsNot Nothing AndAlso orderByStr.Trim <> "" Then Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr) Else Me.CurrentSortOrder = New OrderBy(True, False) End If Dim pageIndex As String = CType(ViewState("Page_Index"), String) If pageIndex IsNot Nothing Then Me.PageIndex = CInt(pageIndex) End If Dim pageSize As String = CType(ViewState("Page_Size"), String) If Not pageSize Is Nothing Then Me.PageSize = CInt(pageSize) End If ' Load view state for pagination control. Me.DeletedRecordIds = CType(Me.ViewState("DeletedRecordIds"), String) End Sub Protected Overrides Function SaveViewState() As Object If Me.CurrentSortOrder IsNot Nothing Then Me.ViewState("PersonalEducationTableControl_OrderBy") = Me.CurrentSortOrder.ToXmlString() End If Me.ViewState("Page_Index") = Me.PageIndex Me.ViewState("Page_Size") = Me.PageSize Me.ViewState("DeletedRecordIds") = Me.DeletedRecordIds ' Load view state for pagination control. Return MyBase.SaveViewState() End Function ' Generate the event handling functions for pagination events. ' event handler for ImageButton Public Overridable Sub PersonalEducationPagination_FirstPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try Me.PageIndex = 0 Me.DataChanged = True Catch ex As Exception Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally End Try End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationPagination_LastPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try Me.DisplayLastPage = True Me.DataChanged = True Catch ex As Exception Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally End Try End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationPagination_NextPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try Me.PageIndex += 1 Me.DataChanged = True Catch ex As Exception Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally End Try End Sub ' event handler for LinkButton Public Overridable Sub PersonalEducationPagination_PageSizeButton_Click(ByVal sender As Object, ByVal args As EventArgs) Try Me.DataChanged = True Me.PageSize = Integer.Parse(Me.PersonalEducationPagination.PageSize.Text) Me.PageIndex = Integer.Parse(Me.PersonalEducationPagination.CurrentPage.Text) - 1 Catch ex As Exception Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally End Try End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationPagination_PreviousPage_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try If Me.PageIndex > 0 Then Me.PageIndex -= 1 Me.DataChanged = True End If Catch ex As Exception Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally End Try End Sub ' Generate the event handling functions for sorting events. Public Overridable Sub CommandDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by CommandDate when clicked. ' Get previous sorting state for CommandDate. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CommandDate) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for CommandDate. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.CommandDate, OrderByItem.OrderDir.Asc) Else ' Previously sorted by CommandDate, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub CommandLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by Command when clicked. ' Get previous sorting state for Command. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Command) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for Command. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.Command, OrderByItem.OrderDir.Asc) Else ' Previously sorted by Command, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub COUNTRYLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by COUNTRY when clicked. ' Get previous sorting state for COUNTRY. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.COUNTRY) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for COUNTRY. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.COUNTRY, OrderByItem.OrderDir.Asc) Else ' Previously sorted by COUNTRY, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub CourseAbbrLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by CourseAbbr when clicked. ' Get previous sorting state for CourseAbbr. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseAbbr) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for CourseAbbr. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.CourseAbbr, OrderByItem.OrderDir.Asc) Else ' Previously sorted by CourseAbbr, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub CourseLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by Course when clicked. ' Get previous sorting state for Course. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Course) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for Course. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.Course, OrderByItem.OrderDir.Asc) Else ' Previously sorted by Course, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub CourseNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by CourseNo when clicked. ' Get previous sorting state for CourseNo. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.CourseNo) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for CourseNo. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.CourseNo, OrderByItem.OrderDir.Asc) Else ' Previously sorted by CourseNo, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub EducationPeriodLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by EducationPeriod when clicked. ' Get previous sorting state for EducationPeriod. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationPeriod) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for EducationPeriod. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.EducationPeriod, OrderByItem.OrderDir.Asc) Else ' Previously sorted by EducationPeriod, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub EducationTypeLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by EducationType when clicked. ' Get previous sorting state for EducationType. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EducationType) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for EducationType. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.EducationType, OrderByItem.OrderDir.Asc) Else ' Previously sorted by EducationType, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub EdYearLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by EdYear when clicked. ' Get previous sorting state for EdYear. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EdYear) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for EdYear. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.EdYear, OrderByItem.OrderDir.Asc) Else ' Previously sorted by EdYear, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub EndDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by EndDate when clicked. ' Get previous sorting state for EndDate. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.EndDate) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for EndDate. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.EndDate, OrderByItem.OrderDir.Asc) Else ' Previously sorted by EndDate, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub FacultryLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by Facultry when clicked. ' Get previous sorting state for Facultry. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Facultry) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for Facultry. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.Facultry, OrderByItem.OrderDir.Asc) Else ' Previously sorted by Facultry, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub InstitueLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by Institue when clicked. ' Get previous sorting state for Institue. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Institue) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for Institue. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.Institue, OrderByItem.OrderDir.Asc) Else ' Previously sorted by Institue, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub LevelIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by LevelId when clicked. ' Get previous sorting state for LevelId. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.LevelId) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for LevelId. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.LevelId, OrderByItem.OrderDir.Asc) Else ' Previously sorted by LevelId, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub NoAllLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by NoAll when clicked. ' Get previous sorting state for NoAll. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.NoAll) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for NoAll. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.NoAll, OrderByItem.OrderDir.Asc) Else ' Previously sorted by NoAll, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub PersonalIdLabel1_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by PersonalId when clicked. ' Get previous sorting state for PersonalId. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.PersonalId) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for PersonalId. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.PersonalId, OrderByItem.OrderDir.Asc) Else ' Previously sorted by PersonalId, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub ScoreLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by Score when clicked. ' Get previous sorting state for Score. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.Score) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for Score. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.Score, OrderByItem.OrderDir.Asc) Else ' Previously sorted by Score, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub ScoreNoLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by ScoreNo when clicked. ' Get previous sorting state for ScoreNo. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.ScoreNo) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for ScoreNo. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.ScoreNo, OrderByItem.OrderDir.Asc) Else ' Previously sorted by ScoreNo, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub Public Overridable Sub StartDateLabel_Click(ByVal sender As Object, ByVal args As EventArgs) ' Sorts by StartDate when clicked. ' Get previous sorting state for StartDate. Dim sd As OrderByItem = Me.CurrentSortOrder.Find(PersonalEducationTable.StartDate) If sd Is Nothing OrElse (Me.CurrentSortOrder.Items IsNot Nothing Andalso Me.CurrentSortOrder.Items.Length > 1) Then ' First time sort, so add sort order for StartDate. Me.CurrentSortOrder.Reset() Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) Else ' Previously sorted by StartDate, so just reverse. sd.Reverse() End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub ' Generate the event handling functions for button events. ' event handler for ImageButton Public Overridable Sub PersonalEducationExportCSVButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction ' Build the where clause based on the current filter and search criteria ' Create the Order By clause based on the user's current sorting preference. Dim wc As WhereClause = CreateWhereClause Dim orderBy As OrderBy = Nothing orderBy = CreateOrderBy ' Add each of the columns in order of export. Dim columns() as BaseColumn = New BaseColumn() { _ PersonalEducationTable.PersonalId, _ PersonalEducationTable.StartDate, _ PersonalEducationTable.EndDate, _ PersonalEducationTable.Course, _ PersonalEducationTable.CourseAbbr, _ PersonalEducationTable.Institue, _ PersonalEducationTable.Facultry, _ PersonalEducationTable.LevelId, _ PersonalEducationTable.EdYear, _ PersonalEducationTable.EducationPeriod, _ PersonalEducationTable.EducationType, _ PersonalEducationTable.COUNTRY, _ PersonalEducationTable.CourseNo, _ PersonalEducationTable.ScoreNo, _ PersonalEducationTable.NoAll, _ PersonalEducationTable.Score, _ PersonalEducationTable.Command, _ PersonalEducationTable.CommandDate, _ Nothing} Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalEducationTable.Instance, wc, orderBy, columns) Dim done As Boolean = False Dim totalRowsReturned As Integer = 0 Dim join As CompoundFilter = CreateCompoundJoinFilter() Dim data As DataForExport = New DataForExport(PersonalEducationTable.Instance, wc, orderBy, columns, join) 'Check for Export Data Threshold Dim exportRawValues As Boolean = False Me.TotalRecords = PersonalEducationTable.GetRecordCount(join, wc) If Me.TotalRecords > 10000 Then exportRawValues = True End If exportData.StartExport(Me.Page.Response, exportRawValues) ' Read pageSize records at a time and write out the CSV file. While (Not done) Dim recList As ArrayList = data.GetRows(exportData.pageSize) If recList Is Nothing Then Exit While 'no more records we are done End If totalRowsReturned = recList.Count For Each rec As BaseRecord In recList For Each col As BaseColumn In data.ColumnList If col Is Nothing Then Continue For End If If Not data.IncludeInExport(col) Then Continue For End If Dim val As String = "" If exportRawValues Then val = rec.GetValue(col).ToString() Else Dim _isExpandableNonCompositeForeignKey As Boolean = col.TableDefinition.IsExpandableNonCompositeForeignKey(col) If _isExpandableNonCompositeForeignKey AndAlso col.IsApplyDisplayAs Then val = PersonalEducationTable.GetDFKA(rec.GetValue(col).ToString(), col, Nothing) End If If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(val)) Then val = exportData.GetDataForExport(col, rec) End If End If exportData.WriteColumnData(val, data.IsString(col)) Next col exportData.WriteNewRow() Next rec ' If we already are below the pageSize, then we are done. If totalRowsReturned < exportData.pageSize Then done = True End If End While exportData.FinishExport(Me.Page.Response) Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationExportExcelButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction ' To customize the columns or the format, override this function in Section 1 of the page ' and modify it to your liking. ' Build the where clause based on the current filter and search criteria ' Create the Order By clause based on the user's current sorting preference. Dim wc As WhereClause = CreateWhereClause Dim orderBy As OrderBy = Nothing orderBy = CreateOrderBy Dim done As Boolean = False Dim val As Object = "" ' Read pageSize records at a time and write out the Excel file. Dim totalRowsReturned As Integer = 0 Me.TotalRecords = PersonalEducationTable.GetRecordCount(wc) If Me.TotalRecords > 10000 Then ' Add each of the columns in order of export. Dim columns() as BaseColumn = New BaseColumn() { _ PersonalEducationTable.PersonalId, _ PersonalEducationTable.StartDate, _ PersonalEducationTable.EndDate, _ PersonalEducationTable.Course, _ PersonalEducationTable.CourseAbbr, _ PersonalEducationTable.Institue, _ PersonalEducationTable.Facultry, _ PersonalEducationTable.LevelId, _ PersonalEducationTable.EdYear, _ PersonalEducationTable.EducationPeriod, _ PersonalEducationTable.EducationType, _ PersonalEducationTable.COUNTRY, _ PersonalEducationTable.CourseNo, _ PersonalEducationTable.ScoreNo, _ PersonalEducationTable.NoAll, _ PersonalEducationTable.Score, _ PersonalEducationTable.Command, _ PersonalEducationTable.CommandDate, _ Nothing} Dim exportData as ExportDataToCSV = New ExportDataToCSV(PersonalEducationTable.Instance, wc, orderBy, columns) exportData.StartExport(Me.Page.Response, True) Dim dataForCSV As DataForExport = New DataForExport(PersonalEducationTable.Instance, wc, orderBy, columns) ' Read pageSize records at a time and write out the CSV file. While (Not done) Dim recList As ArrayList = dataForCSV.GetRows(exportData.pageSize) If recList Is Nothing Then Exit While 'no more records we are done End If totalRowsReturned = recList.Count For Each rec As BaseRecord In recList For Each col As BaseColumn In dataForCSV.ColumnList If col Is Nothing Then Continue For End If If Not dataForCSV.IncludeInExport(col) Then Continue For End If val = rec.GetValue(col).ToString() exportData.WriteColumnData(val, dataForCSV.IsString(col)) Next col exportData.WriteNewRow() Next rec ' If we already are below the pageSize, then we are done. If totalRowsReturned < exportData.pageSize Then done = True End If End While exportData.FinishExport(Me.Page.Response) Else ' Create an instance of the Excel report class with the table class, where clause and order by. Dim excelReport As ExportDataToExcel = New ExportDataToExcel(PersonalEducationTable.Instance, wc, orderBy) ' Add each of the columns in order of export. ' To customize the data type, change the second parameter of the new ExcelColumn to be ' a format string from Excel's Format Cell menu. For example "dddd, mmmm dd, yyyy h:mm AM/PM;@", "#,##0.00" If Me.Page.Response Is Nothing Then Return End If excelReport.CreateExcelBook() Dim width As Integer = 0 Dim columnCounter As Integer = 0 Dim data As DataForExport = New DataForExport(PersonalEducationTable.Instance, wc, orderBy, Nothing) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.PersonalId, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.StartDate, "Short Date")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EndDate, "Short Date")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Course, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.CourseAbbr, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Institue, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Facultry, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.LevelId, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EdYear, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EducationPeriod, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.EducationType, "0")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.COUNTRY, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.CourseNo, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.ScoreNo, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.NoAll, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Score, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.Command, "Default")) data.ColumnList.Add(New ExcelColumn(PersonalEducationTable.CommandDate, "Short Date")) For Each col As ExcelColumn In data.ColumnList width = excelReport.GetExcelCellWidth(col) If data.IncludeInExport(col) Then excelReport.AddColumnToExcelBook(columnCounter, col.ToString(), excelReport.GetExcelDataType(col), width, excelReport.GetDisplayFormat(col)) columnCounter = columnCounter + 1 End If Next col While (Not done) Dim recList As ArrayList = data.GetRows(excelReport.pageSize) If recList Is Nothing Then Exit While 'no more records we are done End If totalRowsReturned = recList.Count For Each rec As BaseRecord In recList excelReport.AddRowToExcelBook() columnCounter = 0 For Each col As ExcelColumn In data.ColumnList If Not data.IncludeInExport(col) Then Continue For End If Dim _isExpandableNonCompositeForeignKey As Boolean = col.DisplayColumn.TableDefinition.IsExpandableNonCompositeForeignKey(col.DisplayColumn) If _isExpandableNonCompositeForeignKey AndAlso col.DisplayColumn.IsApplyDisplayAs Then val = PersonalEducationTable.GetDFKA(rec.GetValue(col.DisplayColumn).ToString(), col.DisplayColumn, Nothing) If val Is Nothing Then val = rec.Format(col.DisplayColumn) End If Else val = excelReport.GetValueForExcelExport(col, rec) End If excelReport.AddCellToExcelRow(columnCounter, excelReport.GetExcelDataType(col), val, col.DisplayFormat) columnCounter = columnCounter + 1 Next col Next rec ' If we already are below the pageSize, then we are done. If totalRowsReturned < excelReport.pageSize Then done = True End If End While excelReport.SaveExcelBook(Me.Page.Response) End If Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationNewButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) ' The redirect URL is set on the Properties, Custom Properties or Actions. ' The ModifyRedirectURL call resolves the parameters before the ' Response.Redirect redirects the page to the URL. ' Any code after the Response.Redirect call will not be executed, since the page is ' redirected to the URL. Dim url As String = "../PersonalEducation/AddPersonalEducation.aspx" Dim shouldRedirect As Boolean = True Dim TargetKey As String = Nothing Dim DFKA As String = TargetKey Dim id As String = DFKA Dim value As String = id Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction url = Me.ModifyRedirectUrl(url, "",False) url = Me.Page.ModifyRedirectUrl(url, "",False) Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) shouldRedirect = False Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try If shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.Response.Redirect(url) ElseIf Not TargetKey Is Nothing AndAlso _ Not shouldRedirect Then Me.Page.ShouldSaveControlsToSession = True Me.Page.CloseWindow(True) End If End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationPDFButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction Dim report As PDFReport = New PDFReport() report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalEducationTable.PersonalEducationPDFButton.report") ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} report.Title = "PersonalEducation" ' If ShowPersonalEducationTable.PersonalEducationPDFButton.report specifies a valid report template, ' AddColumn method will generate a report template. ' Each AddColumn method-call specifies a column ' The 1st parameter represents the text of the column header ' The 2nd parameter represents the horizontal alignment of the column header ' The 3rd parameter represents the text format of the column detail ' The 4th parameter represents the horizontal alignment of the column detail ' The 5th parameter represents the relative width of the column report.AddColumn(PersonalEducationTable.PersonalId.Name, ReportEnum.Align.Left, "${PersonalId}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.StartDate.Name, ReportEnum.Align.Left, "${StartDate}", ReportEnum.Align.Left, 20) report.AddColumn(PersonalEducationTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) report.AddColumn(PersonalEducationTable.Course.Name, ReportEnum.Align.Left, "${Course}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.CourseAbbr.Name, ReportEnum.Align.Left, "${CourseAbbr}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.Institue.Name, ReportEnum.Align.Left, "${Institue}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.Facultry.Name, ReportEnum.Align.Left, "${Facultry}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.LevelId.Name, ReportEnum.Align.Left, "${LevelId}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.EdYear.Name, ReportEnum.Align.Left, "${EdYear}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.EducationPeriod.Name, ReportEnum.Align.Left, "${EducationPeriod}", ReportEnum.Align.Left, 20) report.AddColumn(PersonalEducationTable.EducationType.Name, ReportEnum.Align.Right, "${EducationType}", ReportEnum.Align.Right, 15) report.AddColumn(PersonalEducationTable.COUNTRY.Name, ReportEnum.Align.Left, "${COUNTRY}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.CourseNo.Name, ReportEnum.Align.Left, "${CourseNo}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.ScoreNo.Name, ReportEnum.Align.Left, "${ScoreNo}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.NoAll.Name, ReportEnum.Align.Left, "${NoAll}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.Score.Name, ReportEnum.Align.Left, "${Score}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) Dim rowsPerQuery As Integer = 5000 Dim recordCount As Integer = 0 report.Page = Page.GetResourceValue("Txt:Page", "Persons") report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) Dim whereClause As WhereClause = CreateWhereClause Dim orderBy As OrderBy = CreateOrderBy Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() Dim pageNum As Integer = 0 Dim totalRows As Integer = PersonalEducationTable.GetRecordCount(joinFilter,whereClause) Dim columns As ColumnList = PersonalEducationTable.GetColumnList() Dim records As PersonalEducationRecord() = Nothing Do records = PersonalEducationTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then For Each record As PersonalEducationRecord In records ' AddData method takes four parameters ' The 1st parameters represent the data format ' The 2nd parameters represent the data value ' The 3rd parameters represent the default alignment of column using the data ' The 4th parameters represent the maximum length of the data value being shown If BaseClasses.Utils.MiscUtils.IsNull(record.PersonalId) Then report.AddData("${PersonalId}", "",ReportEnum.Align.Left) Else Dim _isExpandableNonCompositeForeignKey as Boolean Dim _DFKA as String = "" _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) _DFKA = PersonalEducationTable.GetDFKA(record.PersonalId.ToString(), PersonalEducationTable.PersonalId,Nothing) If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then report.AddData("${PersonalId}", _DFKA,ReportEnum.Align.Left) Else report.AddData("${PersonalId}", record.Format(PersonalEducationTable.PersonalId), ReportEnum.Align.Left) End If End If report.AddData("${StartDate}", record.Format(PersonalEducationTable.StartDate), ReportEnum.Align.Left, 100) report.AddData("${EndDate}", record.Format(PersonalEducationTable.EndDate), ReportEnum.Align.Left, 100) report.AddData("${Course}", record.Format(PersonalEducationTable.Course), ReportEnum.Align.Left, 100) report.AddData("${CourseAbbr}", record.Format(PersonalEducationTable.CourseAbbr), ReportEnum.Align.Left, 100) report.AddData("${Institue}", record.Format(PersonalEducationTable.Institue), ReportEnum.Align.Left, 100) report.AddData("${Facultry}", record.Format(PersonalEducationTable.Facultry), ReportEnum.Align.Left, 100) If BaseClasses.Utils.MiscUtils.IsNull(record.LevelId) Then report.AddData("${LevelId}", "",ReportEnum.Align.Left, 100) Else Dim _isExpandableNonCompositeForeignKey as Boolean Dim _DFKA as String = "" _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) _DFKA = PersonalEducationTable.GetDFKA(record.LevelId.ToString(), PersonalEducationTable.LevelId,Nothing) If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then report.AddData("${LevelId}", _DFKA,ReportEnum.Align.Left, 100) Else report.AddData("${LevelId}", record.Format(PersonalEducationTable.LevelId), ReportEnum.Align.Left, 100) End If End If report.AddData("${EdYear}", record.Format(PersonalEducationTable.EdYear), ReportEnum.Align.Left, 100) If BaseClasses.Utils.MiscUtils.IsNull(record.EducationPeriod) Then report.AddData("${EducationPeriod}", "",ReportEnum.Align.Left, 100) Else Dim _isExpandableNonCompositeForeignKey as Boolean Dim _DFKA as String = "" _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) _DFKA = PersonalEducationTable.GetDFKA(record.EducationPeriod.ToString(), PersonalEducationTable.EducationPeriod,Nothing) If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then report.AddData("${EducationPeriod}", _DFKA,ReportEnum.Align.Left, 100) Else report.AddData("${EducationPeriod}", record.Format(PersonalEducationTable.EducationPeriod), ReportEnum.Align.Left, 100) End If End If report.AddData("${EducationType}", record.Format(PersonalEducationTable.EducationType), ReportEnum.Align.Right, 100) If BaseClasses.Utils.MiscUtils.IsNull(record.COUNTRY) Then report.AddData("${COUNTRY}", "",ReportEnum.Align.Left, 100) Else Dim _isExpandableNonCompositeForeignKey as Boolean Dim _DFKA as String = "" _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) _DFKA = PersonalEducationTable.GetDFKA(record.COUNTRY.ToString(), PersonalEducationTable.COUNTRY,Nothing) If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then report.AddData("${COUNTRY}", _DFKA,ReportEnum.Align.Left, 100) Else report.AddData("${COUNTRY}", record.Format(PersonalEducationTable.COUNTRY), ReportEnum.Align.Left, 100) End If End If report.AddData("${CourseNo}", record.Format(PersonalEducationTable.CourseNo), ReportEnum.Align.Left, 100) report.AddData("${ScoreNo}", record.Format(PersonalEducationTable.ScoreNo), ReportEnum.Align.Left, 100) report.AddData("${NoAll}", record.Format(PersonalEducationTable.NoAll), ReportEnum.Align.Left, 100) report.AddData("${Score}", record.Format(PersonalEducationTable.Score), ReportEnum.Align.Left, 100) report.AddData("${Command}", record.Format(PersonalEducationTable.Command), ReportEnum.Align.Left, 100) report.AddData("${CommandDate}", record.Format(PersonalEducationTable.CommandDate), ReportEnum.Align.Left, 100) report.WriteRow Next pageNum = pageNum + 1 recordCount += records.Length End If Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery report.Close BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".pdf", report.ReportInByteArray, 0, true) Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try Dim PersonalEducationTableControlObj as PersonalEducationTableControl = DirectCast(Me.Page.FindControlRecursively("PersonalEducationTableControl"), PersonalEducationTableControl) PersonalEducationTableControlObj.ResetData = True PersonalEducationTableControlObj.RemoveFromSession(PersonalEducationTableControlObj, "DeletedRecordIds") PersonalEducationTableControlObj.DeletedRecordIds = Nothing Catch ex As Exception Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally End Try End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try Me.COUNTRYFilter.ClearSelection() Me.LevelIdFilter.ClearSelection() Me.PersonalIdFilter.ClearSelection() Me.PersonalEducationSearch.Text = "" Me.CurrentSortOrder.Reset() If Me.InSession(Me, "Order_By") Then Me.CurrentSortOrder = OrderBy.FromXmlString(Me.GetFromSession(Me, "Order_By", Nothing)) Else Me.CurrentSortOrder = New OrderBy(True, False) Me.CurrentSortOrder.Add(PersonalEducationTable.PersonalId, OrderByItem.OrderDir.Asc) Me.CurrentSortOrder.Add(PersonalEducationTable.StartDate, OrderByItem.OrderDir.Asc) End If ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True Catch ex As Exception Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally End Try End Sub ' event handler for ImageButton Public Overridable Sub PersonalEducationWordButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs) Try ' Enclose all database retrieval/update code within a Transaction boundary DbUtils.StartTransaction Dim report As WordReport = New WordReport report.SpecificReportFileName = Page.Server.MapPath("ShowPersonalEducationTable.PersonalEducationWordButton.word") ' report.Title replaces the value tag of page header and footer containing ${ReportTitle} report.Title = "PersonalEducation" ' If ShowPersonalEducationTable.PersonalEducationWordButton.report specifies a valid report template, ' AddColumn method will generate a report template. ' Each AddColumn method-call specifies a column ' The 1st parameter represents the text of the column header ' The 2nd parameter represents the horizontal alignment of the column header ' The 3rd parameter represents the text format of the column detail ' The 4th parameter represents the horizontal alignment of the column detail ' The 5th parameter represents the relative width of the column report.AddColumn(PersonalEducationTable.PersonalId.Name, ReportEnum.Align.Left, "${PersonalId}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.StartDate.Name, ReportEnum.Align.Left, "${StartDate}", ReportEnum.Align.Left, 20) report.AddColumn(PersonalEducationTable.EndDate.Name, ReportEnum.Align.Left, "${EndDate}", ReportEnum.Align.Left, 20) report.AddColumn(PersonalEducationTable.Course.Name, ReportEnum.Align.Left, "${Course}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.CourseAbbr.Name, ReportEnum.Align.Left, "${CourseAbbr}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.Institue.Name, ReportEnum.Align.Left, "${Institue}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.Facultry.Name, ReportEnum.Align.Left, "${Facultry}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.LevelId.Name, ReportEnum.Align.Left, "${LevelId}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.EdYear.Name, ReportEnum.Align.Left, "${EdYear}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.EducationPeriod.Name, ReportEnum.Align.Left, "${EducationPeriod}", ReportEnum.Align.Left, 20) report.AddColumn(PersonalEducationTable.EducationType.Name, ReportEnum.Align.Right, "${EducationType}", ReportEnum.Align.Right, 15) report.AddColumn(PersonalEducationTable.COUNTRY.Name, ReportEnum.Align.Left, "${COUNTRY}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.CourseNo.Name, ReportEnum.Align.Left, "${CourseNo}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.ScoreNo.Name, ReportEnum.Align.Left, "${ScoreNo}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.NoAll.Name, ReportEnum.Align.Left, "${NoAll}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.Score.Name, ReportEnum.Align.Left, "${Score}", ReportEnum.Align.Left, 15) report.AddColumn(PersonalEducationTable.Command.Name, ReportEnum.Align.Left, "${Command}", ReportEnum.Align.Left, 30) report.AddColumn(PersonalEducationTable.CommandDate.Name, ReportEnum.Align.Left, "${CommandDate}", ReportEnum.Align.Left, 20) Dim whereClause As WhereClause = CreateWhereClause Dim orderBy As OrderBy = CreateOrderBy Dim joinFilter As BaseFilter = CreateCompoundJoinFilter() Dim rowsPerQuery As Integer = 5000 Dim pageNum As Integer = 0 Dim recordCount As Integer = 0 Dim totalRows As Integer = PersonalEducationTable.GetRecordCount(joinFilter,whereClause) report.Page = Page.GetResourceValue("Txt:Page", "Persons") report.ApplicationPath = Me.Page.MapPath(Page.Request.ApplicationPath) Dim columns As ColumnList = PersonalEducationTable.GetColumnList() Dim records As PersonalEducationRecord() = Nothing Do records = PersonalEducationTable.GetRecords(joinFilter,whereClause, orderBy, pageNum, rowsPerQuery) If Not (records Is Nothing) AndAlso records.Length > 0 AndAlso whereClause.RunQuery Then For Each record As PersonalEducationRecord In records ' AddData method takes four parameters ' The 1st parameters represent the data format ' The 2nd parameters represent the data value ' The 3rd parameters represent the default alignment of column using the data ' The 4th parameters represent the maximum length of the data value being shown If BaseClasses.Utils.MiscUtils.IsNull(record.PersonalId) Then report.AddData("${PersonalId}", "",ReportEnum.Align.Left) Else Dim _isExpandableNonCompositeForeignKey as Boolean Dim _DFKA as String = "" _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId) _DFKA = PersonalEducationTable.GetDFKA(record.PersonalId.ToString(), PersonalEducationTable.PersonalId,Nothing) If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then report.AddData("${PersonalId}", _DFKA,ReportEnum.Align.Left) Else report.AddData("${PersonalId}", record.Format(PersonalEducationTable.PersonalId), ReportEnum.Align.Left) End If End If report.AddData("${StartDate}", record.Format(PersonalEducationTable.StartDate), ReportEnum.Align.Left, 100) report.AddData("${EndDate}", record.Format(PersonalEducationTable.EndDate), ReportEnum.Align.Left, 100) report.AddData("${Course}", record.Format(PersonalEducationTable.Course), ReportEnum.Align.Left, 100) report.AddData("${CourseAbbr}", record.Format(PersonalEducationTable.CourseAbbr), ReportEnum.Align.Left, 100) report.AddData("${Institue}", record.Format(PersonalEducationTable.Institue), ReportEnum.Align.Left, 100) report.AddData("${Facultry}", record.Format(PersonalEducationTable.Facultry), ReportEnum.Align.Left, 100) If BaseClasses.Utils.MiscUtils.IsNull(record.LevelId) Then report.AddData("${LevelId}", "",ReportEnum.Align.Left, 100) Else Dim _isExpandableNonCompositeForeignKey as Boolean Dim _DFKA as String = "" _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId) _DFKA = PersonalEducationTable.GetDFKA(record.LevelId.ToString(), PersonalEducationTable.LevelId,Nothing) If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then report.AddData("${LevelId}", _DFKA,ReportEnum.Align.Left, 100) Else report.AddData("${LevelId}", record.Format(PersonalEducationTable.LevelId), ReportEnum.Align.Left, 100) End If End If report.AddData("${EdYear}", record.Format(PersonalEducationTable.EdYear), ReportEnum.Align.Left, 100) If BaseClasses.Utils.MiscUtils.IsNull(record.EducationPeriod) Then report.AddData("${EducationPeriod}", "",ReportEnum.Align.Left, 100) Else Dim _isExpandableNonCompositeForeignKey as Boolean Dim _DFKA as String = "" _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.EducationPeriod) _DFKA = PersonalEducationTable.GetDFKA(record.EducationPeriod.ToString(), PersonalEducationTable.EducationPeriod,Nothing) If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.EducationPeriod.IsApplyDisplayAs Then report.AddData("${EducationPeriod}", _DFKA,ReportEnum.Align.Left, 100) Else report.AddData("${EducationPeriod}", record.Format(PersonalEducationTable.EducationPeriod), ReportEnum.Align.Left, 100) End If End If report.AddData("${EducationType}", record.Format(PersonalEducationTable.EducationType), ReportEnum.Align.Right, 100) If BaseClasses.Utils.MiscUtils.IsNull(record.COUNTRY) Then report.AddData("${COUNTRY}", "",ReportEnum.Align.Left, 100) Else Dim _isExpandableNonCompositeForeignKey as Boolean Dim _DFKA as String = "" _isExpandableNonCompositeForeignKey = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY) _DFKA = PersonalEducationTable.GetDFKA(record.COUNTRY.ToString(), PersonalEducationTable.COUNTRY,Nothing) If _isExpandableNonCompositeForeignKey AndAlso (not _DFKA Is Nothing) AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then report.AddData("${COUNTRY}", _DFKA,ReportEnum.Align.Left, 100) Else report.AddData("${COUNTRY}", record.Format(PersonalEducationTable.COUNTRY), ReportEnum.Align.Left, 100) End If End If report.AddData("${CourseNo}", record.Format(PersonalEducationTable.CourseNo), ReportEnum.Align.Left, 100) report.AddData("${ScoreNo}", record.Format(PersonalEducationTable.ScoreNo), ReportEnum.Align.Left, 100) report.AddData("${NoAll}", record.Format(PersonalEducationTable.NoAll), ReportEnum.Align.Left, 100) report.AddData("${Score}", record.Format(PersonalEducationTable.Score), ReportEnum.Align.Left, 100) report.AddData("${Command}", record.Format(PersonalEducationTable.Command), ReportEnum.Align.Left, 100) report.AddData("${CommandDate}", record.Format(PersonalEducationTable.CommandDate), ReportEnum.Align.Left, 100) report.WriteRow Next pageNum = pageNum + 1 recordCount += records.Length End If Loop While Not (records Is Nothing) AndAlso recordCount < totalRows AndAlso whereClause.RunQuery report.save BaseClasses.Utils.NetUtils.WriteResponseBinaryAttachment(Me.Page.Response, report.Title + ".doc", report.ReportInByteArray, 0, true) Catch ex As Exception ' Upon error, rollback the transaction Me.Page.RollBackTransaction(sender) Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally DbUtils.EndTransaction End Try End Sub ' event handler for Button with Layout Public Overridable Sub PersonalEducationSearchButton_Click(ByVal sender As Object, ByVal args As EventArgs) Try Me.DataChanged = True Catch ex As Exception Me.Page.ErrorOnPage = True ' Report the error message to the end user Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message) Finally End Try End Sub ' Generate the event handling functions for filter and search events. ' event handler for FieldFilter Protected Overridable Sub COUNTRYFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub ' event handler for FieldFilter Protected Overridable Sub LevelIdFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub ' event handler for FieldFilter Protected Overridable Sub PersonalIdFilter_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs) ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True End Sub ' Generate the event handling functions for others Private _UIData As New System.Collections.Generic.List(Of Hashtable) Public Property UIData() As System.Collections.Generic.List(Of Hashtable) Get Return Me._UIData End Get Set(ByVal value As System.Collections.Generic.List(Of Hashtable)) Me._UIData = value End Set End Property ' pagination properties Protected _PageSize As Integer Public Property PageSize() As Integer Get Return Me._PageSize End Get Set(ByVal value As Integer) Me._PageSize = value End Set End Property Protected _PageIndex As Integer Public Property PageIndex() As Integer Get ' Return the PageIndex Return Me._PageIndex End Get Set(ByVal value As Integer) Me._PageIndex = value End Set End Property Protected _TotalRecords As Integer = -1 Public Property TotalRecords() As Integer Get If _TotalRecords < 0 _TotalRecords = PersonalEducationTable.GetRecordCount(CreateCompoundJoinFilter(), CreateWhereClause()) End If Return Me._TotalRecords End Get Set(ByVal value As Integer) If Me.PageSize > 0 Then Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize)) End If Me._TotalRecords = value End Set End Property Protected _TotalPages As Integer = -1 Public Property TotalPages() As Integer Get If _TotalPages < 0 Then Me.TotalPages = CInt(Math.Ceiling(TotalRecords / Me.PageSize)) End If Return Me._TotalPages End Get Set(ByVal value As Integer) Me._TotalPages = value End Set End Property Protected _DisplayLastPage As Boolean Public Property DisplayLastPage() As Boolean Get Return Me._DisplayLastPage End Get Set(ByVal value As Boolean) Me._DisplayLastPage = value End Set End Property Private _DataChanged As Boolean = False Public Property DataChanged() As Boolean Get Return Me._DataChanged End Get Set(ByVal value As Boolean) Me._DataChanged = value End Set End Property Private _ResetData As Boolean = False Public Property ResetData() As Boolean Get Return Me._ResetData End Get Set(ByVal value As Boolean) Me._ResetData = value End Set End Property Private _AddNewRecord As Integer = 0 Public Property AddNewRecord() As Integer Get Return Me._AddNewRecord End Get Set(ByVal value As Integer) Me._AddNewRecord = value End Set End Property Private _CurrentSortOrder As OrderBy = Nothing Public Property CurrentSortOrder() As OrderBy Get Return Me._CurrentSortOrder End Get Set(ByVal value As BaseClasses.Data.OrderBy) Me._CurrentSortOrder = value End Set End Property Private _DataSource() As PersonalEducationRecord = Nothing Public Property DataSource() As PersonalEducationRecord () Get Return Me._DataSource End Get Set(ByVal value() As PersonalEducationRecord) Me._DataSource = value End Set End Property #Region "Helper Properties" Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property COUNTRYFilter() As System.Web.UI.WebControls.DropDownList Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYFilter"), System.Web.UI.WebControls.DropDownList) End Get End Property Public ReadOnly Property COUNTRYLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property COUNTRYLabel1() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel1"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property LevelIdFilter() As System.Web.UI.WebControls.DropDownList Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdFilter"), System.Web.UI.WebControls.DropDownList) End Get End Property Public ReadOnly Property LevelIdLabel() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property LevelIdLabel1() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel1"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property PersonalEducationExportCSVButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationExportCSVButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationExportExcelButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationExportExcelButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationNewButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationNewButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationPagination() As Persons.UI.IPagination Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPagination"), Persons.UI.IPagination) End Get End Property Public ReadOnly Property PersonalEducationPDFButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationPDFButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationRefreshButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRefreshButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationResetButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationResetButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationSearch() As System.Web.UI.WebControls.TextBox Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationSearch"), System.Web.UI.WebControls.TextBox) End Get End Property Public ReadOnly Property PersonalEducationSearchButton() As Persons.UI.IThemeButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationSearchButton"), Persons.UI.IThemeButton) End Get End Property Public ReadOnly Property PersonalEducationTableControlCollapsibleRegion() As System.Web.UI.WebControls.Panel Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlCollapsibleRegion"), System.Web.UI.WebControls.Panel) End Get End Property Public ReadOnly Property PersonalEducationTableControlIcon() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlIcon"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalEducationTableControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTableControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender) End Get End Property Public ReadOnly Property PersonalEducationTitle() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTitle"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property PersonalEducationToggleAll() As System.Web.UI.WebControls.CheckBox Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationToggleAll"), System.Web.UI.WebControls.CheckBox) End Get End Property Public ReadOnly Property PersonalEducationWordButton() As System.Web.UI.WebControls.ImageButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationWordButton"), System.Web.UI.WebControls.ImageButton) End Get End Property Public ReadOnly Property PersonalIdFilter() As System.Web.UI.WebControls.DropDownList Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdFilter"), System.Web.UI.WebControls.DropDownList) End Get End Property Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal) End Get End Property Public ReadOnly Property PersonalIdLabel1() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel1"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.LinkButton Get Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.LinkButton) End Get End Property #End Region #Region "Helper Functions" Public Overrides Overloads Function ModifyRedirectUrl(url As String, arg As String, ByVal bEncrypt As Boolean) As String Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me) End Function Public Overrides Overloads Function EvaluateExpressions(url As String, arg As String, ByVal bEncrypt As Boolean) As String Dim needToProcess As Boolean = AreAnyUrlParametersForMe(url, arg) If (needToProcess) Then Dim recCtl As PersonalEducationTableControlRow = Me.GetSelectedRecordControl() If recCtl Is Nothing AndAlso url.IndexOf("{") >= 0 Then ' Localization. Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) End If Dim rec As PersonalEducationRecord = Nothing If recCtl IsNot Nothing Then rec = recCtl.GetRecord() End If Return EvaluateExpressions(url, arg, rec, bEncrypt) End If Return url End Function Public Overridable Function GetSelectedRecordIndex() As Integer Dim counter As Integer = 0 Dim recControl As PersonalEducationTableControlRow For Each recControl In Me.GetRecordControls() If recControl.PersonalEducationRecordRowSelection.Checked Then Return counter End If counter += 1 Next Return -1 End Function Public Overridable Function GetSelectedRecordControl() As PersonalEducationTableControlRow Dim selectedList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() If selectedList.Length = 0 Then Return Nothing End If Return selectedList(0) End Function Public Overridable Function GetSelectedRecordControls() As PersonalEducationTableControlRow() Dim selectedList As ArrayList = New ArrayList(25) Dim recControl As PersonalEducationTableControlRow For Each recControl In Me.GetRecordControls() If recControl.PersonalEducationRecordRowSelection IsNot Nothing AndAlso recControl.PersonalEducationRecordRowSelection.Checked Then selectedList.Add(recControl) End If Next Return DirectCast(selectedList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) End Function Public Overridable Sub DeleteSelectedRecords(ByVal deferDeletion As Boolean) Dim recList() As PersonalEducationTableControlRow = Me.GetSelectedRecordControls() If recList.Length = 0 Then ' Localization. Throw New Exception(Page.GetResourceValue("Err:NoRecSelected", "Persons")) End If Dim recCtl As PersonalEducationTableControlRow For Each recCtl In recList If deferDeletion Then If Not recCtl.IsNewRecord Then Me.AddToDeletedRecordIds(recCtl) End If recCtl.Visible = False recCtl.PersonalEducationRecordRowSelection.Checked = False Else recCtl.Delete() ' Setting the DataChanged to True results in the page being refreshed with ' the most recent data from the database. This happens in PreRender event ' based on the current sort, search and filter criteria. Me.DataChanged = True Me.ResetData = True End If Next End Sub Public Function GetRecordControls() As PersonalEducationTableControlRow() Dim recList As ArrayList = New ArrayList() Dim rep As System.Web.UI.WebControls.Repeater = CType(Me.FindControl("PersonalEducationTableControlRepeater"), System.Web.UI.WebControls.Repeater) If rep Is Nothing Then Return Nothing Dim repItem As System.Web.UI.WebControls.RepeaterItem For Each repItem In rep.Items Dim recControl As PersonalEducationTableControlRow = DirectCast(repItem.FindControl("PersonalEducationTableControlRow"), PersonalEducationTableControlRow) recList.Add(recControl) Next Return DirectCast(recList.ToArray(GetType(PersonalEducationTableControlRow)), PersonalEducationTableControlRow()) End Function Public Shadows ReadOnly Property Page() As BaseApplicationPage Get Return DirectCast(MyBase.Page, BaseApplicationPage) End Get End Property #End Region End Class #End Region End Namespace