cudreg-saml2/App_Code/PersonalId/IdChange.Controls.vb
2025-06-08 16:22:20 +07:00

1520 lines
No EOL
64 KiB
VB.net

' This file implements the TableControl, TableControlRow, and RecordControl classes for the
' IdChange.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.IdChange
#Region "Section 1: Place your customizations here."
Public Class PersonalIdRecordControl
Inherits BasePersonalIdRecordControl
' The BasePersonalIdRecordControl implements the LoadData, DataBind and other
' methods to load and display the data in a table control.
' This is the ideal place to add your code customizations. For example, you can override the LoadData,
' CreateWhereClause, DataBind, SaveData, GetUIData, and Validate methods.
' SaveData saves data in the database.
' Customize by adding code before or after the call to MyBase.SaveData()
' or replace the call to MyBase.SaveData().
Public Overrides Sub SaveData()
'Dim rec As New PersonalIdRecord
' rec = PersonalIdTable.GetRecord(Me.PersonalId.Text, True)
' rec.PersonalId = "1200000000000"
' rec.Save()
' Me.DataChanged = False
Dim myConnection As System.Data.SqlClient.SqlConnection
Dim myCommand As New System.Data.SqlClient.SqlCommand
Dim result As Integer
myConnection = CType(BaseClasses.Data.SqlProvider.SqlTransaction.GetExistingTransaction().GetADOConnectionByName("DatabasePersons1"), System.Data.SqlClient.SqlConnection)
'Specify the name of the Stored Procedure which is to be run
myCommand.Connection = myConnection
myCommand.CommandType = System.Data.CommandType.StoredProcedure
myCommand.CommandTimeout = 15
'myCommand.ExecuteScalar()
myCommand.Parameters.AddWithValue("@pid", "0000000000000")
myCommand.Parameters.AddWithValue("@NewPid", "3160101741051")
myCommand.CommandText = "ChangePid"
result = myCommand.ExecuteNonQuery
End Sub
End Class
#End Region
#Region "Section 2: Do not modify this section."
' Base class for the PersonalIdRecordControl control on the IdChange page.
' Do not modify this class. Instead override any method in PersonalIdRecordControl.
Public Class BasePersonalIdRecordControl
Inherits Persons.UI.BaseApplicationRecordControl
' To customize, override this method in PersonalIdRecordControl.
Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init
' Setup the filter and search events.
If Not Me.Page.IsPostBack Then
Dim initialVal As String = ""
If Me.InSession(Me.PersonalIdSearch1)
initialVal = Me.GetFromSession(Me.PersonalIdSearch1)
End If
If initialVal <> ""
Me.PersonalIdSearch1.Text = 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)
End If
Me.PageIndex = CInt(Me.GetFromSession(Me, "Page_Index", "0"))
Me.ClearControlsFromSession()
End Sub
' To customize, override this method in PersonalIdRecordControl.
Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
SaveControlsToSession_Ajax()
' Setup the pagination events.
' Register the event handlers.
AddHandler Me.PersonalIdRefreshButton.Click, AddressOf PersonalIdRefreshButton_Click
AddHandler Me.PersonalIdResetButton.Click, AddressOf PersonalIdResetButton_Click
AddHandler Me.PersonalIdSaveButton.Click, AddressOf PersonalIdSaveButton_Click
Me.PersonalIdSaveButton.Attributes.Add("onclick", "SubmitHRefOnce(this, """ & Me.Page.GetResourceValue("Txt:SaveRecord", "Persons") & """);")
AddHandler Me.PersonalIdSearchButton1.Button.Click, AddressOf PersonalIdSearchButton1_Click
AddHandler Me.PersonalId.TextChanged, AddressOf PersonalId_TextChanged
AddHandler Me.PersonalLastName.TextChanged, AddressOf PersonalLastName_TextChanged
AddHandler Me.PersonalName.TextChanged, AddressOf PersonalName_TextChanged
End Sub
Public Overridable Sub LoadData()
' Load the data from the database into the DataSource PersonalId record.
' It is better to make changes to functions called by LoadData such as
' CreateWhereClause, rather than making changes here.
' This is the first time a record is being retrieved from the database.
' So create a Where Clause based on the staic Where clause specified
' on the Query wizard and the dynamic part specified by the end user
' on the search and filter controls (if any).
Dim wc As WhereClause = Me.CreateWhereClause()
Dim Panel As System.Web.UI.WebControls.Panel = CType(MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel)
If Not Panel is Nothing Then
Panel.visible = True
End If
' If there is no Where clause, then simply create a new, blank record.
If wc Is Nothing OrElse Not wc.RunQuery Then
Me.DataSource = New PersonalIdRecord()
If Not Panel is Nothing Then
Panel.visible = False
End If
Return
End If
Dim filterJoin As CompoundFilter = CreateCompoundJoinFilter()
Me.TotalPages = PersonalIdTable.GetRecordCount(filterJoin, wc)
If Me.DisplayLastPage Then
Me.PageIndex = Me.TotalPages - 1
End If
' Retrieve the record from the database. It is possible
Dim orderBy As OrderBy = CreateOrderBy()
Dim recList() As PersonalIdRecord = PersonalIdTable.GetRecords(filterJoin, wc, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE, Me.TotalPages)
If recList.Length = 0 Then
' There is no data for this Where clause.
Me.PageIndex = 0
Me.DataSource = New PersonalIdRecord()
Me.RecordUniqueId = Nothing
If Not Panel is Nothing Then
Panel.visible = False
End If
Return
Else If Me.PageIndex >= recList.Length Then
Me.PageIndex = recList.Length - 1
Else If Me.PageIndex < 0 Then
Me.PageIndex = 0
End If
' Set DataSource based on record retrieved from the database.
Me.DataSource = PersonalIdTable.GetRecord(recList(Me.PageIndex).GetID.ToXmlString(), True)
End Sub
' Populate the UI controls using the DataSource. To customize, override this method in PersonalIdRecordControl.
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
SetPersonalId()
SetPersonalIdLabel()
SetPersonalIdRecordControlCollapsibleRegion()
SetPersonalIdSearch1()
SetPersonalLastName()
SetPersonalLastNameLabel()
SetPersonalName()
SetPersonalNameLabel()
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 SetPersonalId()
' Set the PersonalId TextBox on the webpage with value from the
' PersonalId database record.
' Me.DataSource is the PersonalId record retrieved from the database.
' Me.PersonalId is the ASP:TextBox 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 use the Display Format
Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalId)
Me.PersonalId.Text = formattedValue
Else
' PersonalId is NULL in the database, so use the Default Value.
' Default Value could also be NULL.
Me.PersonalId.Text = PersonalIdTable.PersonalId.Format(PersonalIdTable.PersonalId.DefaultValue)
End If
End Sub
Public Overridable Sub SetPersonalLastName()
' Set the PersonalLastName TextBox on the webpage with value from the
' PersonalId database record.
' Me.DataSource is the PersonalId record retrieved from the database.
' Me.PersonalLastName is the ASP:TextBox on the webpage.
' You can modify this method directly, or replace it with a call to
' MyBase.SetPersonalLastName()
' and add your own code before or after the call to the MyBase function.
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalLastNameSpecified Then
' If the PersonalLastName is non-NULL, then format the value.
' The Format method will use the Display Format
Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalLastName)
Me.PersonalLastName.Text = formattedValue
Else
' PersonalLastName is NULL in the database, so use the Default Value.
' Default Value could also be NULL.
Me.PersonalLastName.Text = PersonalIdTable.PersonalLastName.Format(PersonalIdTable.PersonalLastName.DefaultValue)
End If
End Sub
Public Overridable Sub SetPersonalName()
' Set the PersonalName TextBox on the webpage with value from the
' PersonalId database record.
' Me.DataSource is the PersonalId record retrieved from the database.
' Me.PersonalName is the ASP:TextBox on the webpage.
' You can modify this method directly, or replace it with a call to
' MyBase.SetPersonalName()
' and add your own code before or after the call to the MyBase function.
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalNameSpecified Then
' If the PersonalName is non-NULL, then format the value.
' The Format method will use the Display Format
Dim formattedValue As String = Me.DataSource.Format(PersonalIdTable.PersonalName)
Me.PersonalName.Text = formattedValue
Else
' PersonalName is NULL in the database, so use the Default Value.
' Default Value could also be NULL.
Me.PersonalName.Text = PersonalIdTable.PersonalName.Format(PersonalIdTable.PersonalName.DefaultValue)
End If
End Sub
Public Overridable Sub SetPersonalIdLabel()
End Sub
Public Overridable Sub SetPersonalIdRecordControlCollapsibleRegion()
End Sub
Public Overridable Sub SetPersonalLastNameLabel()
End Sub
Public Overridable Sub SetPersonalNameLabel()
End Sub
Public Overridable Sub ResetControl()
Me.PersonalIdSearch1.Text = ""
Me.RecordUniqueId = Nothing
Me.PageIndex = 0
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()
Me.Page.RegisterPostBackTrigger(MiscUtils.FindControlRecursively(Me,"PersonalIdSaveButton"))
End Sub
' To customize, override this method in PersonalIdRecordControl.
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()
Dim Panel As System.Web.UI.WebControls.Panel = CType(MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlPanel"), System.Web.UI.WebControls.Panel)
If ((Not IsNothing(Panel)) AndAlso (Not Panel.Visible)) OrElse IsNothing(Me.DataSource) Then
Return
End If
' 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()
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 PersonalIdRecordControl.
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.
GetPersonalId()
GetPersonalLastName()
GetPersonalName()
End Sub
Public Overridable Sub GetPersonalId()
' Retrieve the value entered by the user on the PersonalId ASP:TextBox, and
' save it into the PersonalId field in DataSource PersonalId record.
' Custom validation should be performed in Validate, not here.
'Save the value to data source
Me.DataSource.Parse(Me.PersonalId.Text, PersonalIdTable.PersonalId)
End Sub
Public Overridable Sub GetPersonalLastName()
' Retrieve the value entered by the user on the PersonalLastName ASP:TextBox, and
' save it into the PersonalLastName field in DataSource PersonalId record.
' Custom validation should be performed in Validate, not here.
'Save the value to data source
Me.DataSource.Parse(Me.PersonalLastName.Text, PersonalIdTable.PersonalLastName)
End Sub
Public Overridable Sub GetPersonalName()
' Retrieve the value entered by the user on the PersonalName ASP:TextBox, and
' save it into the PersonalName field in DataSource PersonalId record.
' Custom validation should be performed in Validate, not here.
'Save the value to data source
Me.DataSource.Parse(Me.PersonalName.Text, PersonalIdTable.PersonalName)
End Sub
Public Overridable Function CreateCompoundJoinFilter() As CompoundFilter
Dim jFilter As CompoundFilter = New CompoundFilter()
Return jFilter
End Function
Public Overridable Function CreateOrderBy() As OrderBy
Return Me.CurrentSortOrder
End Function
' To customize, override this method in PersonalIdRecordControl.
Public Overridable Function CreateWhereClause() As WhereClause
Dim wc As WhereClause
PersonalIdTable.Instance.InnerFilter = Nothing
wc = New WhereClause()
' Compose the WHERE clause consiting of:
' 1. Static clause defined at design time.
' 2. User selected filter criteria.
' 3. User selected search criteria.
If IsValueSelected(Me.PersonalIdSearch1) Then
If Me.PersonalIdSearch1.Text = BaseClasses.Resources.AppResources.GetResourceValue("Txt:SearchForEllipsis", Nothing) Then
Me.PersonalIdSearch1.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.PersonalIdSearch1.Text.StartsWith("...") Then
Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(3,Me.PersonalIdSearch1.Text.Length-3)
End If
If Me.PersonalIdSearch1.Text.EndsWith("...") then
Me.PersonalIdSearch1.Text = Me.PersonalIdSearch1.Text.SubString(0,Me.PersonalIdSearch1.Text.Length-3)
' Strip the last word as well as it is likely only a partial word
Dim endindex As Integer = PersonalIdSearch1.Text.Length - 1
While (Not Char.IsWhiteSpace(PersonalIdSearch1.Text(endindex)) AndAlso endindex > 0)
endindex -= 1
End While
If endindex > 0 Then
PersonalIdSearch1.Text = PersonalIdSearch1.Text.Substring(0, endindex)
End If
End If
End If
Dim formatedSearchText As String = MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1))
' After stripping "..." see if the search text is null or empty.
If IsValueSelected(Me.PersonalIdSearch1) 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(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, MiscUtils.GetSelectedValue(Me.PersonalIdSearch1, Me.GetFromSession(Me.PersonalIdSearch1)), True, False)
wc.iAND(search)
End If
End If
Dim bAnyFiltersChanged As Boolean = False
If IsValueSelected(Me.PersonalIdSearch1) OrElse Me.InSession(Me.PersonalIdSearch1) Then
bAnyFiltersChanged = True
End If
If bAnyFiltersChanged Then
Return wc
Else
wc.RunQuery = False
End If
' Retrieve the record id from the URL parameter.
Dim recId As String = Me.Page.Request.QueryString.Item("PersonalId")
If Not recId Is Nothing AndAlso Not recId.Trim = "" Then
HttpContext.Current.Session("QueryString in IdChange") = recId
If KeyValue.IsXmlKey(recId) Then
' Keys are typically passed as XML structures to handle composite keys.
' If XML, then add a Where clause based on the Primary Key in the XML.
Dim pkValue As KeyValue = KeyValue.XmlToKey(recId)
wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalIdTable.PersonalId))
Else
' The URL parameter contains the actual value, not an XML structure.
wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, recId)
End If
Return wc
End If
Return wc
End Function
' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature.
Public Overridable Function CreateWhereClause(ByVal searchText As String, ByVal fromSearchControl As String, ByVal AutoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String) As WhereClause
PersonalIdTable.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 filter criteria.
' 3. User selected search 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.
If IsValueSelected(searchText) and fromSearchControl = "PersonalIdSearch1" 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(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, True, False)
search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators & formatedSearchText, True, False)
Else
search.iOR(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, True, False)
End If
wc.iAND(search)
End If
End If
' Retrieve the record id from the session.
Dim recId As String = DirectCast(HttpContext.Current.Session("QueryString in IdChange"), String)
If Not recId Is Nothing AndAlso Not recId.Trim = "" Then
If KeyValue.IsXmlKey(recId) Then
Dim pkValue As KeyValue = KeyValue.XmlToKey(recId)
wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalIdTable.PersonalId))
Else
wc.iAND(PersonalIdTable.PersonalId, BaseFilter.ComparisonOperator.EqualsTo, recId)
End If
End If
Return wc
End Function
Public Overridable Function GetAutoCompletionList_PersonalIdSearch1(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,"PersonalIdSearch1", "WordsStartingWithSearchString", "[^a-zA-Z0-9]")
While (resultList.Count < count AndAlso iteration < 5)
' Fetch 100 records in each iteration
Dim records() As Persons.Business.PersonalIdRecord = PersonalIdTable.GetRecords(filterJoin, wc, Nothing, iteration, 100)
Dim rec As PersonalIdRecord = Nothing
Dim resultItem As String = ""
For Each rec In records
' 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(PersonalIdTable.PersonalName)
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 records.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
'Formats the resultItem and adds it to the list of suggestions.
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
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
Public Overridable Sub SetPersonalIdSearch1()
End Sub
' To customize, override this method in PersonalIdRecordControl.
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)
PersonalIdTable.DeleteRecord(pkValue)
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 filter controls to values to session.
Me.SaveToSession(Me.PersonalIdSearch1, Me.PersonalIdSearch1.Text)
' 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())
'Save pagination state to session.
End Sub
Protected Sub SaveControlsToSession_Ajax()
' Save filter controls to values to session.
Me.SaveToSession("PersonalIdSearch1_Ajax", Me.PersonalIdSearch1.Text)
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.PersonalIdSearch1)
' Clear table properties from the session.
Me.RemoveFromSession(Me, "Page_Index")
' 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 pageIndex As String = CType(ViewState("Page_Index"), String)
If Not pageIndex Is Nothing Then
Me.PageIndex = CInt(pageIndex)
End If
Dim orderByStr As String = CType(ViewState("PersonalIdRecordControl_OrderBy"), String)
If Not orderByStr Is Nothing AndAlso orderByStr.Trim <> "" Then
Me.CurrentSortOrder = BaseClasses.Data.OrderBy.FromXmlString(orderByStr)
Else
Me.CurrentSortOrder = New OrderBy(True, False)
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
ViewState("Page_Index") = Me.PageIndex
If Not Me.CurrentSortOrder Is Nothing Then
Me.ViewState("PersonalIdRecordControl_OrderBy") = Me.CurrentSortOrder.ToXmlString()
End If
' Load view state for pagination control.
Return MyBase.SaveViewState()
End Function
' Generate the event handling functions for pagination events.
' Generate the event handling functions for filter and search events.
' event handler for ImageButton
Public Overridable Sub PersonalIdRefreshButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs)
Try
Dim PersonalIdRecordControlObj as PersonalIdRecordControl = DirectCast(Me.Page.FindControlRecursively("PersonalIdRecordControl"), PersonalIdRecordControl)
PersonalIdRecordControlObj.ResetData = 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 PersonalIdResetButton_Click(ByVal sender As Object, ByVal args As ImageClickEventArgs)
Try
Me.PersonalIdSearch1.Text = ""
Me.RecordUniqueId = Nothing
' 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 PersonalIdSaveButton_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.SaveData()
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 Button with Layout
Public Overridable Sub PersonalIdSearchButton1_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
Protected Overridable Sub PersonalId_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
End Sub
Protected Overridable Sub PersonalLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
End Sub
Protected Overridable Sub PersonalName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
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("BasePersonalIdRecordControl_Rec"), String)
End Get
Set(ByVal value As String)
Me.ViewState("BasePersonalIdRecordControl_Rec") = value
End Set
End Property
Private _DataSource As PersonalIdRecord
Public Property DataSource() As PersonalIdRecord
Get
Return Me._DataSource
End Get
Set(ByVal value As PersonalIdRecord)
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 _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
Private _TotalRecords As Integer
Public Property TotalRecords() As Integer
Get
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
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
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
#Region "Helper Properties"
Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.TextBox
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.TextBox)
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 PersonalIdRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel)
End Get
End Property
Public ReadOnly Property PersonalIdRefreshButton() As System.Web.UI.WebControls.ImageButton
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdRefreshButton"), System.Web.UI.WebControls.ImageButton)
End Get
End Property
Public ReadOnly Property PersonalIdResetButton() As System.Web.UI.WebControls.ImageButton
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdResetButton"), System.Web.UI.WebControls.ImageButton)
End Get
End Property
Public ReadOnly Property PersonalIdSaveButton() As System.Web.UI.WebControls.ImageButton
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSaveButton"), System.Web.UI.WebControls.ImageButton)
End Get
End Property
Public ReadOnly Property PersonalIdSearch1() As System.Web.UI.WebControls.TextBox
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearch1"), System.Web.UI.WebControls.TextBox)
End Get
End Property
Public ReadOnly Property PersonalIdSearchButton1() As Persons.UI.IThemeButton
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdSearchButton1"), Persons.UI.IThemeButton)
End Get
End Property
Public ReadOnly Property PersonalIdTitle() As System.Web.UI.WebControls.Literal
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdTitle"), System.Web.UI.WebControls.Literal)
End Get
End Property
Public ReadOnly Property PersonalLastName() As System.Web.UI.WebControls.TextBox
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastName"), System.Web.UI.WebControls.TextBox)
End Get
End Property
Public ReadOnly Property PersonalLastNameLabel() As System.Web.UI.WebControls.Literal
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalLastNameLabel"), System.Web.UI.WebControls.Literal)
End Get
End Property
Public ReadOnly Property PersonalName() As System.Web.UI.WebControls.TextBox
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalName"), System.Web.UI.WebControls.TextBox)
End Get
End Property
Public ReadOnly Property PersonalNameLabel() As System.Web.UI.WebControls.Literal
Get
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalNameLabel"), 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 PersonalIdRecord = 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:NoRecSelected", "Persons"))
End If
Return EvaluateExpressions(url, arg, rec, bEncrypt)
End Function
Public Overridable Function GetRecord() As PersonalIdRecord
If Not Me.DataSource Is Nothing Then
Return Me.DataSource
End If
If Not Me.RecordUniqueId Is Nothing Then
Return PersonalIdTable.GetRecord(Me.RecordUniqueId, True)
End If
' Localization.
Return Nothing
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