2893 lines
No EOL
123 KiB
VB.net
2893 lines
No EOL
123 KiB
VB.net
|
|
' This file implements the TableControl, TableControlRow, and RecordControl classes for the
|
|
' EditPersonRelative.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.EditPersonRelative
|
|
|
|
#Region "Section 1: Place your customizations here."
|
|
|
|
|
|
Public Class PersonRelativeRecordControl
|
|
Inherits BasePersonRelativeRecordControl
|
|
' The BasePersonRelativeRecordControl 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.
|
|
|
|
|
|
End Class
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
#Region "Section 2: Do not modify this section."
|
|
|
|
|
|
' Base class for the PersonRelativeRecordControl control on the EditPersonRelative page.
|
|
' Do not modify this class. Instead override any method in PersonRelativeRecordControl.
|
|
Public Class BasePersonRelativeRecordControl
|
|
Inherits Persons.UI.BaseApplicationRecordControl
|
|
|
|
' To customize, override this method in PersonRelativeRecordControl.
|
|
Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init
|
|
|
|
' Setup the filter and search events.
|
|
|
|
Me.ClearControlsFromSession()
|
|
End Sub
|
|
|
|
' To customize, override this method in PersonRelativeRecordControl.
|
|
Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|
|
|
' Setup the pagination events.
|
|
|
|
|
|
' Register the event handlers.
|
|
|
|
AddHandler Me.RelationId.SelectedIndexChanged, AddressOf RelationId_SelectedIndexChanged
|
|
|
|
AddHandler Me.RStatus.SelectedIndexChanged, AddressOf RStatus_SelectedIndexChanged
|
|
|
|
AddHandler Me.FLastName.TextChanged, AddressOf FLastName_TextChanged
|
|
|
|
AddHandler Me.FName.TextChanged, AddressOf FName_TextChanged
|
|
|
|
AddHandler Me.MLastName.TextChanged, AddressOf MLastName_TextChanged
|
|
|
|
AddHandler Me.MName.TextChanged, AddressOf MName_TextChanged
|
|
|
|
AddHandler Me.MOrLastName.TextChanged, AddressOf MOrLastName_TextChanged
|
|
|
|
AddHandler Me.RAddress.TextChanged, AddressOf RAddress_TextChanged
|
|
|
|
AddHandler Me.RAmphur.TextChanged, AddressOf RAmphur_TextChanged
|
|
|
|
AddHandler Me.RBirthDate.TextChanged, AddressOf RBirthDate_TextChanged
|
|
|
|
AddHandler Me.Ref1.TextChanged, AddressOf Ref1_TextChanged
|
|
|
|
AddHandler Me.RefDate.TextChanged, AddressOf RefDate_TextChanged
|
|
|
|
AddHandler Me.RFirstName.TextChanged, AddressOf RFirstName_TextChanged
|
|
|
|
AddHandler Me.RLastName.TextChanged, AddressOf RLastName_TextChanged
|
|
|
|
AddHandler Me.RNationality.TextChanged, AddressOf RNationality_TextChanged
|
|
|
|
AddHandler Me.ROrigin.TextChanged, AddressOf ROrigin_TextChanged
|
|
|
|
AddHandler Me.ROrLastName.TextChanged, AddressOf ROrLastName_TextChanged
|
|
|
|
AddHandler Me.RPreName.TextChanged, AddressOf RPreName_TextChanged
|
|
|
|
AddHandler Me.RProvince.TextChanged, AddressOf RProvince_TextChanged
|
|
|
|
AddHandler Me.RReligion.TextChanged, AddressOf RReligion_TextChanged
|
|
|
|
AddHandler Me.RRemark.TextChanged, AddressOf RRemark_TextChanged
|
|
|
|
AddHandler Me.RStatusDate.TextChanged, AddressOf RStatusDate_TextChanged
|
|
|
|
AddHandler Me.RStatusRef.TextChanged, AddressOf RStatusRef_TextChanged
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
Public Overridable Sub LoadData()
|
|
|
|
' Load the data from the database into the DataSource PersonRelative 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 = PersonRelativeTable.GetRecord(Me.RecordUniqueId, True)
|
|
|
|
Return
|
|
End If
|
|
|
|
' 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, "PersonRelativeRecordControlPanel"), 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 PersonRelativeRecord()
|
|
|
|
If Not Panel is Nothing Then
|
|
Panel.visible = False
|
|
End If
|
|
|
|
Return
|
|
End If
|
|
|
|
' Retrieve the record from the database. It is possible
|
|
|
|
Dim recList() As PersonRelativeRecord = PersonRelativeTable.GetRecords(wc, Nothing, 0, 2)
|
|
If recList.Length = 0 Then
|
|
' There is no data for this Where clause.
|
|
wc.RunQuery = False
|
|
|
|
If Not Panel is Nothing Then
|
|
Panel.visible = False
|
|
End If
|
|
|
|
Return
|
|
End If
|
|
|
|
' Set DataSource based on record retrieved from the database.
|
|
Me.DataSource = PersonRelativeTable.GetRecord(recList(0).GetID.ToXmlString(), True)
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
' Populate the UI controls using the DataSource. To customize, override this method in PersonRelativeRecordControl.
|
|
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
|
|
|
|
SetFLastName()
|
|
SetFLastNameLabel()
|
|
SetFName()
|
|
SetFNameLabel()
|
|
SetMLastName()
|
|
SetMLastNameLabel()
|
|
SetMName()
|
|
SetMNameLabel()
|
|
SetMOrLastName()
|
|
SetMOrLastNameLabel()
|
|
SetPersonRelativeRecordControlCollapsibleRegion()
|
|
SetPersonRelativeRecordControlIcon()
|
|
SetPersonRelativeRecordControlPanelExtender()
|
|
|
|
SetRAddress()
|
|
SetRAddressLabel()
|
|
SetRAmphur()
|
|
SetRAmphurLabel()
|
|
SetRBirthDate()
|
|
SetRBirthDateLabel()
|
|
SetRef1()
|
|
SetRefDate()
|
|
SetRefDateLabel()
|
|
SetRefLabel()
|
|
SetRelationId()
|
|
SetRelationIdLabel()
|
|
SetRFirstName()
|
|
SetRFirstNameLabel()
|
|
SetRLastName()
|
|
SetRLastNameLabel()
|
|
SetRNationality()
|
|
SetRNationalityLabel()
|
|
SetROrigin()
|
|
SetROriginLabel()
|
|
SetROrLastName()
|
|
SetROrLastNameLabel()
|
|
SetRPreName()
|
|
SetRPreNameLabel()
|
|
SetRProvince()
|
|
SetRProvinceLabel()
|
|
SetRReligion()
|
|
SetRReligionLabel()
|
|
SetRRemark()
|
|
SetRRemarkLabel()
|
|
SetRStatus()
|
|
SetRStatusDate()
|
|
SetRStatusDateLabel()
|
|
SetRStatusLabel()
|
|
SetRStatusRef()
|
|
SetRStatusRefLabel()
|
|
|
|
|
|
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 SetFLastName()
|
|
|
|
|
|
' Set the FLastName TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.FLastName is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetFLastName()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FLastNameSpecified Then
|
|
|
|
' If the FLastName is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.FLastName)
|
|
|
|
Me.FLastName.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' FLastName is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.FLastName.Text = PersonRelativeTable.FLastName.Format(PersonRelativeTable.FLastName.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetFName()
|
|
|
|
|
|
' Set the FName TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.FName is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetFName()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FNameSpecified Then
|
|
|
|
' If the FName is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.FName)
|
|
|
|
Me.FName.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' FName is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.FName.Text = PersonRelativeTable.FName.Format(PersonRelativeTable.FName.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetMLastName()
|
|
|
|
|
|
' Set the MLastName TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.MLastName is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetMLastName()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MLastNameSpecified Then
|
|
|
|
' If the MLastName is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.MLastName)
|
|
|
|
Me.MLastName.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' MLastName is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.MLastName.Text = PersonRelativeTable.MLastName.Format(PersonRelativeTable.MLastName.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetMName()
|
|
|
|
|
|
' Set the MName TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.MName is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetMName()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MNameSpecified Then
|
|
|
|
' If the MName is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.MName)
|
|
|
|
Me.MName.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' MName is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.MName.Text = PersonRelativeTable.MName.Format(PersonRelativeTable.MName.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetMOrLastName()
|
|
|
|
|
|
' Set the MOrLastName TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.MOrLastName is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetMOrLastName()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.MOrLastNameSpecified Then
|
|
|
|
' If the MOrLastName is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.MOrLastName)
|
|
|
|
Me.MOrLastName.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' MOrLastName is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.MOrLastName.Text = PersonRelativeTable.MOrLastName.Format(PersonRelativeTable.MOrLastName.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRAddress()
|
|
|
|
|
|
' Set the RAddress TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RAddress is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRAddress()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RAddressSpecified Then
|
|
|
|
' If the RAddress is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RAddress)
|
|
|
|
Me.RAddress.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RAddress is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RAddress.Text = PersonRelativeTable.RAddress.Format(PersonRelativeTable.RAddress.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRAmphur()
|
|
|
|
|
|
' Set the RAmphur TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RAmphur is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRAmphur()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RAmphurSpecified Then
|
|
|
|
' If the RAmphur is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RAmphur)
|
|
|
|
Me.RAmphur.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RAmphur is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RAmphur.Text = PersonRelativeTable.RAmphur.Format(PersonRelativeTable.RAmphur.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRBirthDate()
|
|
|
|
|
|
' Set the RBirthDate TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RBirthDate is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRBirthDate()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RBirthDateSpecified Then
|
|
|
|
' If the RBirthDate is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RBirthDate, "d MMM yy")
|
|
|
|
Me.RBirthDate.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RBirthDate is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RBirthDate.Text = PersonRelativeTable.RBirthDate.Format(PersonRelativeTable.RBirthDate.DefaultValue, "d MMM yy")
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRef1()
|
|
|
|
|
|
' Set the Ref TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.Ref1 is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRef1()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.Ref0Specified Then
|
|
|
|
' If the Ref is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.Ref0)
|
|
|
|
Me.Ref1.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' Ref is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.Ref1.Text = PersonRelativeTable.Ref0.Format(PersonRelativeTable.Ref0.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRefDate()
|
|
|
|
|
|
' Set the RefDate TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RefDate is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRefDate()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RefDateSpecified Then
|
|
|
|
' If the RefDate is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RefDate, "d MMM yy")
|
|
|
|
Me.RefDate.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RefDate is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RefDate.Text = PersonRelativeTable.RefDate.Format(PersonRelativeTable.RefDate.DefaultValue, "d MMM yy")
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRelationId()
|
|
|
|
|
|
' Set the RelationId DropDownList on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RelationId is the ASP:DropDownList on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRelationId()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RelationIdSpecified Then
|
|
|
|
' If the RelationId is non-NULL, then format the value.
|
|
' The Format method will return the Display Foreign Key As (DFKA) value
|
|
Me.PopulateRelationIdDropDownList(Me.DataSource.RelationId.ToString(), 100)
|
|
|
|
Else
|
|
|
|
' RelationId is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.IsCreated Then
|
|
Me.PopulateRelationIdDropDownList(Nothing, 100)
|
|
Else
|
|
Me.PopulateRelationIdDropDownList(PersonRelativeTable.RelationId.DefaultValue, 100)
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRFirstName()
|
|
|
|
|
|
' Set the RFirstName TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RFirstName is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRFirstName()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RFirstNameSpecified Then
|
|
|
|
' If the RFirstName is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RFirstName)
|
|
|
|
Me.RFirstName.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RFirstName is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RFirstName.Text = PersonRelativeTable.RFirstName.Format(PersonRelativeTable.RFirstName.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRLastName()
|
|
|
|
|
|
' Set the RLastName TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RLastName is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRLastName()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RLastNameSpecified Then
|
|
|
|
' If the RLastName is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RLastName)
|
|
|
|
Me.RLastName.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RLastName is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RLastName.Text = PersonRelativeTable.RLastName.Format(PersonRelativeTable.RLastName.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRNationality()
|
|
|
|
|
|
' Set the RNationality TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RNationality is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRNationality()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RNationalitySpecified Then
|
|
|
|
' If the RNationality is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RNationality)
|
|
|
|
Me.RNationality.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RNationality is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RNationality.Text = PersonRelativeTable.RNationality.Format(PersonRelativeTable.RNationality.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetROrigin()
|
|
|
|
|
|
' Set the ROrigin TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.ROrigin is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetROrigin()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ROriginSpecified Then
|
|
|
|
' If the ROrigin is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.ROrigin)
|
|
|
|
Me.ROrigin.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' ROrigin is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.ROrigin.Text = PersonRelativeTable.ROrigin.Format(PersonRelativeTable.ROrigin.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetROrLastName()
|
|
|
|
|
|
' Set the ROrLastName TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.ROrLastName is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetROrLastName()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ROrLastNameSpecified Then
|
|
|
|
' If the ROrLastName is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.ROrLastName)
|
|
|
|
Me.ROrLastName.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' ROrLastName is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.ROrLastName.Text = PersonRelativeTable.ROrLastName.Format(PersonRelativeTable.ROrLastName.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRPreName()
|
|
|
|
|
|
' Set the RPreName TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RPreName is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRPreName()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RPreNameSpecified Then
|
|
|
|
' If the RPreName is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RPreName)
|
|
|
|
Me.RPreName.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RPreName is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RPreName.Text = PersonRelativeTable.RPreName.Format(PersonRelativeTable.RPreName.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRProvince()
|
|
|
|
|
|
' Set the RProvince TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RProvince is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRProvince()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RProvinceSpecified Then
|
|
|
|
' If the RProvince is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RProvince)
|
|
|
|
Me.RProvince.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RProvince is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RProvince.Text = PersonRelativeTable.RProvince.Format(PersonRelativeTable.RProvince.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRReligion()
|
|
|
|
|
|
' Set the RReligion TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RReligion is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRReligion()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RReligionSpecified Then
|
|
|
|
' If the RReligion is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RReligion)
|
|
|
|
Me.RReligion.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RReligion is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RReligion.Text = PersonRelativeTable.RReligion.Format(PersonRelativeTable.RReligion.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRRemark()
|
|
|
|
|
|
' Set the RRemark TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RRemark is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRRemark()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RRemarkSpecified Then
|
|
|
|
' If the RRemark is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RRemark)
|
|
|
|
Me.RRemark.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RRemark is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RRemark.Text = PersonRelativeTable.RRemark.Format(PersonRelativeTable.RRemark.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRStatus()
|
|
|
|
|
|
' Set the RStatus DropDownList on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RStatus is the ASP:DropDownList on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRStatus()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RStatusSpecified Then
|
|
|
|
' If the RStatus is non-NULL, then format the value.
|
|
' The Format method will return the Display Foreign Key As (DFKA) value
|
|
Me.PopulateRStatusDropDownList(Me.DataSource.RStatus.ToString(), 100)
|
|
|
|
Else
|
|
|
|
' RStatus is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.IsCreated Then
|
|
Me.PopulateRStatusDropDownList(Nothing, 100)
|
|
Else
|
|
Me.PopulateRStatusDropDownList(PersonRelativeTable.RStatus.DefaultValue, 100)
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRStatusDate()
|
|
|
|
|
|
' Set the RStatusDate TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RStatusDate is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRStatusDate()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RStatusDateSpecified Then
|
|
|
|
' If the RStatusDate is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RStatusDate, "d MMM yy")
|
|
|
|
Me.RStatusDate.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RStatusDate is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RStatusDate.Text = PersonRelativeTable.RStatusDate.Format(PersonRelativeTable.RStatusDate.DefaultValue, "d MMM yy")
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRStatusRef()
|
|
|
|
|
|
' Set the RStatusRef TextBox on the webpage with value from the
|
|
' PersonRelative database record.
|
|
|
|
' Me.DataSource is the PersonRelative record retrieved from the database.
|
|
' Me.RStatusRef is the ASP:TextBox on the webpage.
|
|
|
|
' You can modify this method directly, or replace it with a call to
|
|
' MyBase.SetRStatusRef()
|
|
' and add your own code before or after the call to the MyBase function.
|
|
|
|
|
|
|
|
If Me.DataSource IsNot Nothing AndAlso Me.DataSource.RStatusRefSpecified Then
|
|
|
|
' If the RStatusRef is non-NULL, then format the value.
|
|
|
|
' The Format method will use the Display Format
|
|
Dim formattedValue As String = Me.DataSource.Format(PersonRelativeTable.RStatusRef)
|
|
|
|
Me.RStatusRef.Text = formattedValue
|
|
|
|
Else
|
|
|
|
' RStatusRef is NULL in the database, so use the Default Value.
|
|
' Default Value could also be NULL.
|
|
|
|
Me.RStatusRef.Text = PersonRelativeTable.RStatusRef.Format(PersonRelativeTable.RStatusRef.DefaultValue)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetFLastNameLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetFNameLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetMLastNameLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetMNameLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetMOrLastNameLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetPersonRelativeRecordControlCollapsibleRegion()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetPersonRelativeRecordControlIcon()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetPersonRelativeRecordControlPanelExtender()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRAddressLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRAmphurLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRBirthDateLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRefDateLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRefLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRelationIdLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRFirstNameLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRLastNameLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRNationalityLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetROriginLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetROrLastNameLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRPreNameLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRProvinceLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRReligionLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRRemarkLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRStatusDateLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRStatusLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub SetRStatusRefLabel()
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub ResetControl()
|
|
|
|
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 PersonRelativeRecordControl.
|
|
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, "PersonRelativeRecordControlPanel"), 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 PersonRelativeRecordControl.
|
|
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.
|
|
|
|
GetFLastName()
|
|
GetFName()
|
|
GetMLastName()
|
|
GetMName()
|
|
GetMOrLastName()
|
|
GetRAddress()
|
|
GetRAmphur()
|
|
GetRBirthDate()
|
|
GetRef1()
|
|
GetRefDate()
|
|
GetRelationId()
|
|
GetRFirstName()
|
|
GetRLastName()
|
|
GetRNationality()
|
|
GetROrigin()
|
|
GetROrLastName()
|
|
GetRPreName()
|
|
GetRProvince()
|
|
GetRReligion()
|
|
GetRRemark()
|
|
GetRStatus()
|
|
GetRStatusDate()
|
|
GetRStatusRef()
|
|
End Sub
|
|
|
|
|
|
Public Overridable Sub GetFLastName()
|
|
|
|
' Retrieve the value entered by the user on the FLastName ASP:TextBox, and
|
|
' save it into the FLastName field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.FLastName.Text, PersonRelativeTable.FLastName)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetFName()
|
|
|
|
' Retrieve the value entered by the user on the FName ASP:TextBox, and
|
|
' save it into the FName field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.FName.Text, PersonRelativeTable.FName)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetMLastName()
|
|
|
|
' Retrieve the value entered by the user on the MLastName ASP:TextBox, and
|
|
' save it into the MLastName field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.MLastName.Text, PersonRelativeTable.MLastName)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetMName()
|
|
|
|
' Retrieve the value entered by the user on the MName ASP:TextBox, and
|
|
' save it into the MName field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.MName.Text, PersonRelativeTable.MName)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetMOrLastName()
|
|
|
|
' Retrieve the value entered by the user on the MOrLastName ASP:TextBox, and
|
|
' save it into the MOrLastName field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.MOrLastName.Text, PersonRelativeTable.MOrLastName)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRAddress()
|
|
|
|
' Retrieve the value entered by the user on the RAddress ASP:TextBox, and
|
|
' save it into the RAddress field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RAddress.Text, PersonRelativeTable.RAddress)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRAmphur()
|
|
|
|
' Retrieve the value entered by the user on the RAmphur ASP:TextBox, and
|
|
' save it into the RAmphur field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RAmphur.Text, PersonRelativeTable.RAmphur)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRBirthDate()
|
|
|
|
' Retrieve the value entered by the user on the RBirthDate ASP:TextBox, and
|
|
' save it into the RBirthDate field in DataSource PersonRelative record.
|
|
' Parse will also validate the date to ensure it is of the proper format
|
|
' and a valid date. The format is verified based on the current culture
|
|
' settings including the order of month, day and year and the separator character.
|
|
' Parse throws an exception if the date is invalid.
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RBirthDate.Text, PersonRelativeTable.RBirthDate)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRef1()
|
|
|
|
' Retrieve the value entered by the user on the Ref ASP:TextBox, and
|
|
' save it into the Ref field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.Ref1.Text, PersonRelativeTable.Ref0)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRefDate()
|
|
|
|
' Retrieve the value entered by the user on the RefDate ASP:TextBox, and
|
|
' save it into the RefDate field in DataSource PersonRelative record.
|
|
' Parse will also validate the date to ensure it is of the proper format
|
|
' and a valid date. The format is verified based on the current culture
|
|
' settings including the order of month, day and year and the separator character.
|
|
' Parse throws an exception if the date is invalid.
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RefDate.Text, PersonRelativeTable.RefDate)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRelationId()
|
|
|
|
' Retrieve the value entered by the user on the RelationId ASP:DropDownList, and
|
|
' save it into the RelationId field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
Me.DataSource.Parse(GetValueSelectedPageRequest(Me.RelationId), PersonRelativeTable.RelationId)
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRFirstName()
|
|
|
|
' Retrieve the value entered by the user on the RFirstName ASP:TextBox, and
|
|
' save it into the RFirstName field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RFirstName.Text, PersonRelativeTable.RFirstName)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRLastName()
|
|
|
|
' Retrieve the value entered by the user on the RLastName ASP:TextBox, and
|
|
' save it into the RLastName field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RLastName.Text, PersonRelativeTable.RLastName)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRNationality()
|
|
|
|
' Retrieve the value entered by the user on the RNationality ASP:TextBox, and
|
|
' save it into the RNationality field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RNationality.Text, PersonRelativeTable.RNationality)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetROrigin()
|
|
|
|
' Retrieve the value entered by the user on the ROrigin ASP:TextBox, and
|
|
' save it into the ROrigin field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.ROrigin.Text, PersonRelativeTable.ROrigin)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetROrLastName()
|
|
|
|
' Retrieve the value entered by the user on the ROrLastName ASP:TextBox, and
|
|
' save it into the ROrLastName field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.ROrLastName.Text, PersonRelativeTable.ROrLastName)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRPreName()
|
|
|
|
' Retrieve the value entered by the user on the RPreName ASP:TextBox, and
|
|
' save it into the RPreName field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RPreName.Text, PersonRelativeTable.RPreName)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRProvince()
|
|
|
|
' Retrieve the value entered by the user on the RProvince ASP:TextBox, and
|
|
' save it into the RProvince field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RProvince.Text, PersonRelativeTable.RProvince)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRReligion()
|
|
|
|
' Retrieve the value entered by the user on the RReligion ASP:TextBox, and
|
|
' save it into the RReligion field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RReligion.Text, PersonRelativeTable.RReligion)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRRemark()
|
|
|
|
' Retrieve the value entered by the user on the RRemark ASP:TextBox, and
|
|
' save it into the RRemark field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RRemark.Text, PersonRelativeTable.RRemark)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRStatus()
|
|
|
|
' Retrieve the value entered by the user on the RStatus ASP:DropDownList, and
|
|
' save it into the RStatus field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
Me.DataSource.Parse(GetValueSelectedPageRequest(Me.RStatus), PersonRelativeTable.RStatus)
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRStatusDate()
|
|
|
|
' Retrieve the value entered by the user on the RStatusDate ASP:TextBox, and
|
|
' save it into the RStatusDate field in DataSource PersonRelative record.
|
|
' Parse will also validate the date to ensure it is of the proper format
|
|
' and a valid date. The format is verified based on the current culture
|
|
' settings including the order of month, day and year and the separator character.
|
|
' Parse throws an exception if the date is invalid.
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RStatusDate.Text, PersonRelativeTable.RStatusDate)
|
|
|
|
|
|
End Sub
|
|
|
|
Public Overridable Sub GetRStatusRef()
|
|
|
|
' Retrieve the value entered by the user on the RStatusRef ASP:TextBox, and
|
|
' save it into the RStatusRef field in DataSource PersonRelative record.
|
|
|
|
' Custom validation should be performed in Validate, not here.
|
|
|
|
'Save the value to data source
|
|
Me.DataSource.Parse(Me.RStatusRef.Text, PersonRelativeTable.RStatusRef)
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
' To customize, override this method in PersonRelativeRecordControl.
|
|
|
|
Public Overridable Function CreateWhereClause() As WhereClause
|
|
|
|
Dim wc As WhereClause
|
|
PersonRelativeTable.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.
|
|
|
|
|
|
' Retrieve the record id from the URL parameter.
|
|
|
|
Dim recId As String = Me.Page.Request.QueryString.Item("PersonRelative")
|
|
|
|
If recId Is Nothing OrElse recId.Trim = "" Then
|
|
' Get the error message from the application resource file.
|
|
Throw New Exception(Page.GetResourceValue("Err:UrlParamMissing", "Persons").Replace("{URL}", "PersonRelative"))
|
|
End If
|
|
HttpContext.Current.Session("QueryString in EditPersonRelative") = 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(PersonRelativeTable.RelativeId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonRelativeTable.RelativeId))
|
|
|
|
Else
|
|
' The URL parameter contains the actual value, not an XML structure.
|
|
|
|
wc.iAND(PersonRelativeTable.RelativeId, BaseFilter.ComparisonOperator.EqualsTo, recId)
|
|
|
|
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
|
|
PersonRelativeTable.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.
|
|
|
|
|
|
|
|
Return wc
|
|
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
|
|
|
|
|
|
|
|
' To customize, override this method in PersonRelativeRecordControl.
|
|
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)
|
|
PersonRelativeTable.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 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
|
|
|
|
|
|
' Generate the event handling functions for pagination events.
|
|
|
|
|
|
' Generate the event handling functions for filter and search events.
|
|
|
|
|
|
Public Overridable Function CreateWhereClause_RelationIdDropDownList() As WhereClause
|
|
' By default, we simply return a new WhereClause.
|
|
' Add additional where clauses to restrict the items shown in the dropdown list.
|
|
|
|
' This WhereClause is for the relation table.
|
|
' Examples:
|
|
' wc.iAND(RelationTable.Relation, BaseFilter.ComparisonOperator.EqualsTo, "XYZ")
|
|
' wc.iAND(RelationTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1")
|
|
|
|
Dim wc As WhereClause = New WhereClause()
|
|
Return wc
|
|
|
|
End Function
|
|
|
|
|
|
|
|
Public Overridable Function CreateWhereClause_RStatusDropDownList() As WhereClause
|
|
' By default, we simply return a new WhereClause.
|
|
' Add additional where clauses to restrict the items shown in the dropdown list.
|
|
|
|
' This WhereClause is for the RStatus table.
|
|
' Examples:
|
|
' wc.iAND(RStatusTable.RStatus, BaseFilter.ComparisonOperator.EqualsTo, "XYZ")
|
|
' wc.iAND(RStatusTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1")
|
|
|
|
Dim wc As WhereClause = New WhereClause()
|
|
Return wc
|
|
|
|
End Function
|
|
|
|
|
|
' Fill the RelationId list.
|
|
Protected Overridable Sub PopulateRelationIdDropDownList( _
|
|
ByVal selectedValue As String, _
|
|
ByVal maxItems As Integer)
|
|
|
|
Me.RelationId.Items.Clear()
|
|
|
|
|
|
' 1. Setup the static list items
|
|
|
|
' Add the Please Select item.
|
|
Me.RelationId.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--"))
|
|
|
|
' 2. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_RelationIdDropDownList function.
|
|
' It is better to customize the where clause there.
|
|
|
|
Dim wc As WhereClause = CreateWhereClause_RelationIdDropDownList()
|
|
' Create the ORDER BY clause to sort based on the displayed value.
|
|
|
|
|
|
Dim orderBy As OrderBy = New OrderBy(false, false)
|
|
orderBy.Add(RelationTable.Relation, OrderByItem.OrderDir.Asc)
|
|
|
|
Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
|
|
|
|
' 3. Read a total of maxItems from the database and insert them
|
|
Dim itemValues() As RelationRecord = Nothing
|
|
Dim evaluator As New FormulaEvaluator
|
|
If wc.RunQuery
|
|
Dim counter As Integer = 0
|
|
Dim pageNum As Integer = 0
|
|
Dim listDuplicates As New ArrayList()
|
|
|
|
Do
|
|
itemValues = RelationTable.GetRecords(wc, orderBy, pageNum, maxItems)
|
|
For each itemValue As RelationRecord In itemValues
|
|
' Create the item and add to the list.
|
|
Dim cvalue As String = Nothing
|
|
Dim fvalue As String = Nothing
|
|
If itemValue.RelationIdSpecified Then
|
|
cvalue = itemValue.RelationId.ToString()
|
|
|
|
If counter < maxItems AndAlso Me.RelationId.Items.FindByValue(cvalue) Is Nothing Then
|
|
|
|
Dim _isExpandableNonCompositeForeignKey As Boolean = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RelationId)
|
|
If _isExpandableNonCompositeForeignKey AndAlso PersonRelativeTable.RelationId.IsApplyDisplayAs Then
|
|
fvalue = PersonRelativeTable.GetDFKA(itemValue, PersonRelativeTable.RelationId)
|
|
End If
|
|
If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
|
|
fvalue = itemValue.Format(RelationTable.Relation)
|
|
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.RelationId.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.RelationId.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
|
|
|
|
|
|
' 4. Set the selected value (insert if not already present).
|
|
|
|
If Not selectedValue Is Nothing AndAlso _
|
|
selectedValue.Trim <> "" AndAlso _
|
|
Not SetSelectedValue(Me.RelationId, selectedValue) AndAlso _
|
|
Not SetSelectedDisplayText(Me.RelationId, selectedValue)Then
|
|
|
|
' construct a whereclause to query a record with relation.RelationId = selectedValue
|
|
Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing)
|
|
Dim whereClause2 As WhereClause = New WhereClause()
|
|
filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(RelationTable.RelationId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False))
|
|
whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator)
|
|
|
|
Try
|
|
' Execute the query
|
|
Dim rc() As RelationRecord = RelationTable.GetRecords(whereClause2, New OrderBy(False, False), 0, 1)
|
|
Dim vars As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
|
|
' if find a record, add it to the dropdown and set it as selected item
|
|
If rc IsNot Nothing AndAlso rc.Length = 1 Then
|
|
Dim itemValue As RelationRecord = DirectCast(rc(0), RelationRecord)
|
|
' Create the item and add to the list.
|
|
Dim cvalue As String = Nothing
|
|
Dim fvalue As String = Nothing
|
|
If itemValue.RelationIdSpecified Then
|
|
cvalue = itemValue.RelationId.ToString()
|
|
Dim _isExpandableNonCompositeForeignKey As Boolean = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RelationId)
|
|
If _isExpandableNonCompositeForeignKey AndAlso PersonRelativeTable.RelationId.IsApplyDisplayAs Then
|
|
fvalue = PersonRelativeTable.GetDFKA(itemValue, PersonRelativeTable.RelationId)
|
|
End If
|
|
If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
|
|
fvalue = itemValue.Format(RelationTable.Relation)
|
|
End If
|
|
|
|
If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue
|
|
Dim newItem As New ListItem(fvalue, cvalue)
|
|
Me.RelationId.Items.Add(newItem)
|
|
SetSelectedValue(Me.RelationId, selectedValue)
|
|
End If
|
|
End If
|
|
Catch
|
|
End Try
|
|
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
' Fill the RStatus list.
|
|
Protected Overridable Sub PopulateRStatusDropDownList( _
|
|
ByVal selectedValue As String, _
|
|
ByVal maxItems As Integer)
|
|
|
|
Me.RStatus.Items.Clear()
|
|
|
|
|
|
' 1. Setup the static list items
|
|
|
|
' Add the Please Select item.
|
|
Me.RStatus.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--"))
|
|
|
|
' 2. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_RStatusDropDownList function.
|
|
' It is better to customize the where clause there.
|
|
|
|
Dim wc As WhereClause = CreateWhereClause_RStatusDropDownList()
|
|
' Create the ORDER BY clause to sort based on the displayed value.
|
|
|
|
|
|
Dim orderBy As OrderBy = New OrderBy(false, false)
|
|
orderBy.Add(RStatusTable.RStatus, OrderByItem.OrderDir.Asc)
|
|
|
|
Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
|
|
|
|
' 3. Read a total of maxItems from the database and insert them
|
|
Dim itemValues() As RStatusRecord = Nothing
|
|
Dim evaluator As New FormulaEvaluator
|
|
If wc.RunQuery
|
|
Dim counter As Integer = 0
|
|
Dim pageNum As Integer = 0
|
|
Dim listDuplicates As New ArrayList()
|
|
|
|
Do
|
|
itemValues = RStatusTable.GetRecords(wc, orderBy, pageNum, maxItems)
|
|
For each itemValue As RStatusRecord In itemValues
|
|
' Create the item and add to the list.
|
|
Dim cvalue As String = Nothing
|
|
Dim fvalue As String = Nothing
|
|
If itemValue.RStatusIdSpecified Then
|
|
cvalue = itemValue.RStatusId.ToString()
|
|
|
|
If counter < maxItems AndAlso Me.RStatus.Items.FindByValue(cvalue) Is Nothing Then
|
|
|
|
Dim _isExpandableNonCompositeForeignKey As Boolean = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RStatus)
|
|
If _isExpandableNonCompositeForeignKey AndAlso PersonRelativeTable.RStatus.IsApplyDisplayAs Then
|
|
fvalue = PersonRelativeTable.GetDFKA(itemValue, PersonRelativeTable.RStatus)
|
|
End If
|
|
If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
|
|
fvalue = itemValue.Format(RStatusTable.RStatus)
|
|
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.RStatus.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.RStatus.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
|
|
|
|
|
|
' 4. Set the selected value (insert if not already present).
|
|
|
|
If Not selectedValue Is Nothing AndAlso _
|
|
selectedValue.Trim <> "" AndAlso _
|
|
Not SetSelectedValue(Me.RStatus, selectedValue) AndAlso _
|
|
Not SetSelectedDisplayText(Me.RStatus, selectedValue)Then
|
|
|
|
' construct a whereclause to query a record with RStatus.RStatusId = selectedValue
|
|
Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing)
|
|
Dim whereClause2 As WhereClause = New WhereClause()
|
|
filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(RStatusTable.RStatusId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False))
|
|
whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator)
|
|
|
|
Try
|
|
' Execute the query
|
|
Dim rc() As RStatusRecord = RStatusTable.GetRecords(whereClause2, New OrderBy(False, False), 0, 1)
|
|
Dim vars As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
|
|
' if find a record, add it to the dropdown and set it as selected item
|
|
If rc IsNot Nothing AndAlso rc.Length = 1 Then
|
|
Dim itemValue As RStatusRecord = DirectCast(rc(0), RStatusRecord)
|
|
' Create the item and add to the list.
|
|
Dim cvalue As String = Nothing
|
|
Dim fvalue As String = Nothing
|
|
If itemValue.RStatusIdSpecified Then
|
|
cvalue = itemValue.RStatusId.ToString()
|
|
Dim _isExpandableNonCompositeForeignKey As Boolean = PersonRelativeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonRelativeTable.RStatus)
|
|
If _isExpandableNonCompositeForeignKey AndAlso PersonRelativeTable.RStatus.IsApplyDisplayAs Then
|
|
fvalue = PersonRelativeTable.GetDFKA(itemValue, PersonRelativeTable.RStatus)
|
|
End If
|
|
If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
|
|
fvalue = itemValue.Format(RStatusTable.RStatus)
|
|
End If
|
|
|
|
If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue
|
|
Dim newItem As New ListItem(fvalue, cvalue)
|
|
Me.RStatus.Items.Add(newItem)
|
|
SetSelectedValue(Me.RStatus, selectedValue)
|
|
End If
|
|
End If
|
|
Catch
|
|
End Try
|
|
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RelationId_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
' for the value inserted by quick add button or large list selector,
|
|
' the value is necessary to be inserted by this event during postback
|
|
Dim val As String = CType(Me.Page.Session()(RelationId.ClientID & "_SelectedValue"), String)
|
|
Dim displayText As String = CType(Me.Page.Session()(RelationId.ClientID & "_SelectedDisplayText"), String)
|
|
If displayText <> "" AndAlso val <> "" Then
|
|
Me.RelationId.Items.Add(New ListItem(displayText, val))
|
|
Me.RelationId.SelectedIndex = Me.RelationId.Items.Count - 1
|
|
Me.Page.Session.Remove(RelationId.ClientID & "_SelectedValue")
|
|
Me.Page.Session.Remove(RelationId.ClientID & "_SelectedDisplayText")
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RStatus_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
' for the value inserted by quick add button or large list selector,
|
|
' the value is necessary to be inserted by this event during postback
|
|
Dim val As String = CType(Me.Page.Session()(RStatus.ClientID & "_SelectedValue"), String)
|
|
Dim displayText As String = CType(Me.Page.Session()(RStatus.ClientID & "_SelectedDisplayText"), String)
|
|
If displayText <> "" AndAlso val <> "" Then
|
|
Me.RStatus.Items.Add(New ListItem(displayText, val))
|
|
Me.RStatus.SelectedIndex = Me.RStatus.Items.Count - 1
|
|
Me.Page.Session.Remove(RStatus.ClientID & "_SelectedValue")
|
|
Me.Page.Session.Remove(RStatus.ClientID & "_SelectedDisplayText")
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub FLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub FName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub MLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub MName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub MOrLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RAddress_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RAmphur_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RBirthDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub Ref1_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RefDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RFirstName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RNationality_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub ROrigin_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub ROrLastName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RPreName_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RProvince_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RReligion_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RRemark_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RStatusDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Protected Overridable Sub RStatusRef_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("BasePersonRelativeRecordControl_Rec"), String)
|
|
End Get
|
|
Set(ByVal value As String)
|
|
Me.ViewState("BasePersonRelativeRecordControl_Rec") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private _DataSource As PersonRelativeRecord
|
|
Public Property DataSource() As PersonRelativeRecord
|
|
Get
|
|
Return Me._DataSource
|
|
End Get
|
|
|
|
Set(ByVal value As PersonRelativeRecord)
|
|
|
|
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
|
|
|
|
|
|
|
|
#Region "Helper Properties"
|
|
|
|
Public ReadOnly Property FLastName() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FLastName"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property FLastNameLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FLastNameLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property FName() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FName"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property FNameLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FNameLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MLastName() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MLastName"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MLastNameLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MLastNameLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MName() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MName"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MNameLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MNameLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MOrLastName() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MOrLastName"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property MOrLastNameLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "MOrLastNameLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PersonRelativeRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PersonRelativeRecordControlIcon() As System.Web.UI.WebControls.ImageButton
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRecordControlIcon"), System.Web.UI.WebControls.ImageButton)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PersonRelativeRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PersonRelativeTitle() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonRelativeTitle"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RAddress() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAddress"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RAddressLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAddressLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RAmphur() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAmphur"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RAmphurLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RAmphurLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RBirthDate() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RBirthDate"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RBirthDateLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RBirthDateLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Ref1() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Ref1"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RefDate() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDate"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RefDateLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefDateLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RefLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RefLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RelationId() As System.Web.UI.WebControls.DropDownList
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RelationId"), System.Web.UI.WebControls.DropDownList)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RelationIdLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RelationIdLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RFirstName() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RFirstName"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RFirstNameLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RFirstNameLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RLastName() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RLastName"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RLastNameLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RLastNameLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RNationality() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RNationality"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RNationalityLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RNationalityLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ROrigin() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROrigin"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ROriginLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROriginLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ROrLastName() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROrLastName"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ROrLastNameLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ROrLastNameLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RPreName() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RPreName"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RPreNameLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RPreNameLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RProvince() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RProvince"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RProvinceLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RProvinceLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RReligion() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RReligion"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RReligionLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RReligionLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RRemark() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RRemark"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RRemarkLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RRemarkLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RStatus() As System.Web.UI.WebControls.DropDownList
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatus"), System.Web.UI.WebControls.DropDownList)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RStatusDate() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusDate"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RStatusDateLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusDateLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RStatusLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusLabel"), System.Web.UI.WebControls.Literal)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RStatusRef() As System.Web.UI.WebControls.TextBox
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusRef"), System.Web.UI.WebControls.TextBox)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RStatusRefLabel() As System.Web.UI.WebControls.Literal
|
|
Get
|
|
Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "RStatusRefLabel"), 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 PersonRelativeRecord = 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 PersonRelativeRecord
|
|
If Not Me.DataSource Is Nothing Then
|
|
Return Me.DataSource
|
|
End If
|
|
|
|
If Not Me.RecordUniqueId Is Nothing Then
|
|
|
|
Return PersonRelativeTable.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
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
End Namespace
|
|
|
|
|